pub fn resolve_coercion(
ctx: &Context,
mctx: &mut MetaCtx,
from: &Term,
to: &Term,
) -> Option<Term>Expand description
Find a registered coercion carrying from to to (up to unification), returning the
coercion FUNCTION to wrap the argument in — Lean’s ↑. The elaborator calls this when
an argument’s type does not match the expected parameter type; a match commits the
unification (a polymorphic coercion’s type variables get solved).
A single registered step is returned as ITSELF. A composed chain is returned as the
λ-abstraction of the composite, so the function is always something that can be applied to
one argument whatever its length; elaboration itself uses coerce_term, which applies
the steps directly and so leaves no β-redex behind.