- ngen : NameGenerator
- lctx : LocalContext
- mctx : MetavarContext
- nextParamIdx : Nat
- lmap : Std.HashMap LMVarId Level
- emap : Std.HashMap MVarId Expr
- abstractLevels : Bool
Instances For
Abstract (current depth) metavariables occurring in e.
The result contains
- An array of universe level parameters that replaced universe metavariables occurring in
e. - The metavariables that have been abstracted.
- And an expression of the form
fun (m_1 : A_1) ... (m_k : A_k) => e', wherekequal to the number of (expr) metavariables abstracted, ande'iseafter we replace the metavariables.
Example: given f.{?u} ?m1 where ?m1 : ?m2 Nat, ?m2 : Type -> Type. This function returns
{ levels := #[u], size := 2, expr := (fun (m2 : Type -> Type) (m1 : m2 Nat) => f.{u} m1) }
This API can be used to "transport" to a different metavariable context.
Given a new metavariable context, we replace the AbstractMVarsResult.levels with
new fresh universe metavariables, and instantiate the (m_i : A_i) in the lambda-expression
with new fresh metavariables.
If levels := false, then level metavariables are not abstracted.
Application: we use this method to cache the results of type class resolution.
Application: tactic MVarId.abstractMVars