Synth-mode resolution: resolve e and synthesize its HighType,
written Γ ⊢ e ⇒ T. Each constructor with a synthesis rule delegates
to its rule's helper. Statement-shaped constructs (While, Exit,
Return, Assert, Assume, Var-Declare) synthesize TVoid.
Synthesis returns a type inferred from the expression itself;
checking (Check.resolveStmtExpr) verifies that the expression has
a given expected type. The two functions are mutually recursive,
with termination on a lexicographic measure (exprMd, tag) — tag
2 for synth, 3 for check, helpers smaller — so that subsumption
(which calls synth on the same expression) can decrease via
Prod.Lex.right.
expected? is the type this expression is being checked against, when
the caller has one. It is NOT a second checking mode: every rule below
ignores it except the call rules, which need it to bind a type argument
that the arguments alone leave undetermined (setEmpty<T>() fixes T
from nowhere else), and the check-capable wrappers IfThenElse,
Block, Old, OldGuarantee, OldRelies and ProveBy, which forward
it to their value-producing children so a call nested in one sees the
same slot a direct one would. Subsumption still happens in
Check.resolveStmtExpr, which is the one place that verifies the
synthesized type against expected — passing it here only sharpens
inference, it never accepts anything extra.