File: .lake/packages/lean4/src/lean/Lean/Meta/AbstractMVars.lean

full_name: Lean.Meta.AbstractMVars.State.paramNames
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Array Lean.Name

full_name: Lean.Meta.AbstractMVars.State.lctx
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Lean.LocalContext

full_name: Lean.Meta.AbstractMVars.State
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Type

full_name: Lean.Meta.AbstractMVars.State.fvars
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Array Lean.Expr

full_name: Lean.Meta.AbstractMVars.State.ngen
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Lean.NameGenerator

full_name: Lean.Meta.AbstractMVars.State.emap
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Lean.HashMap Lean.MVarId Lean.Expr

full_name: Lean.Meta.AbstractMVars.State.nextParamIdx
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Nat

full_name: Lean.Meta.AbstractMVars.State.mctx
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Lean.MetavarContext

full_name: Lean.Meta.AbstractMVars.State.lmap
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Lean.HashMap Lean.LMVarId Lean.Level

full_name: Lean.Meta.AbstractMVars.State.abstractLevels
code: structure State where
  ngen           : NameGenerator
  lctx           : LocalContext
  mctx           : MetavarContext
  nextParamIdx   : Nat := 0
  paramNames     : Array Name := #[]
  fvars          : Array Expr  := #[]
  lmap           : HashMap LMVarId Level := {}
  emap           : HashMap MVarId Expr  := {}
  abstractLevels : Bool
goal: Bool

full_name: Lean.Meta.AbstractMVars.M
code: abbrev M 
goal: Type

full_name: Lean.Meta.AbstractMVars.instMonadMCtxM
code: @[always_inline]
instance : MonadMCtx M 
goal: Lean.MonadMCtx Lean.Meta.AbstractMVars.M

full_name: Lean.Meta.AbstractMVars.mkFreshId
code: def mkFreshId : M Name 
goal: Lean.Meta.AbstractMVars.M Lean.Name

full_name: Lean.Meta.AbstractMVars.mkFreshFVarId
code: def mkFreshFVarId : M FVarId 
goal: Lean.Meta.AbstractMVars.M Lean.FVarId

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.AbstractMVars.0.Lean.Meta.AbstractMVars.abstractLevelMVars
code: private partial def abstractLevelMVars (u : Level) : M Level 
goal: Lean.Meta.AbstractMVars.M Lean.Level

full_name: Lean.Meta.AbstractMVars.abstractExprMVars
code: partial def abstractExprMVars (e : Expr) : M Expr 
goal: Lean.Meta.AbstractMVars.M Lean.Expr

full_name: Lean.Meta.abstractMVars
code: /--
  Abstract (current depth) metavariables occurring in `e`.
  The result contains
  - An array of universe level parameters that replaced universe metavariables occurring in `e`.
  - The number of (expr) metavariables abstracted.
  - And an expression of the form `fun (m_1 : A_1) ... (m_k : A_k) => e'`, where
    `k` equal to the number of (expr) metavariables abstracted, and `e'` is `e` after 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. -/
def abstractMVars (e : Expr) (levels : Bool := true): MetaM AbstractMVarsResult 
goal: Lean.MetaM Lean.Meta.AbstractMVarsResult

full_name: Lean.Meta.openAbstractMVarsResult
code: def openAbstractMVarsResult (a : AbstractMVarsResult) : MetaM (Array Expr × Array BinderInfo × Expr) 
goal: Lean.MetaM (Array Lean.Expr × Array Lean.BinderInfo × Lean.Expr)