pub fn auto_bind_implicits(
ctx: &Context,
ty: &Term,
body: &Term,
existing_implicit: usize,
) -> (Term, Term, usize)Expand description
Auto-bind free type variables as leading implicit parameters. A definition written
id : A -> A := fun a : A => a mentions A as a FREE, unregistered, single-uppercase
global — the type-variable convention. This pass generalizes each such variable: it
prepends Π(A:Type) to the type and λ(A:Type) to the body (converting Global(A)
to the bound Var(A)), and returns the new implicit count, so A becomes an inferred
implicit argument. Definitions that already bind their parameters reference them as
Vars, not free Globals, so they are untouched — this only rescues what was
previously an unbound-variable error.