File: .lake/packages/lean4/src/lean/Lean/MetavarContext.lean

full_name: Lean.LocalInstance
code: /--
`LocalInstance` represents a local typeclass instance registered by and for
the elaborator. It stores the name of the typeclass in `className`, and the
concrete typeclass instance in `fvar`. Note that the kernel does not care about
this information, since typeclasses are entirely eliminated during elaboration.
-/
structure LocalInstance where
  className : Name
  fvar      : Expr
  deriving Inhabited
goal: Type

full_name: Lean.instInhabitedLocalInstance
code: /--
`LocalInstance` represents a local typeclass instance registered by and for
the elaborator. It stores the name of the typeclass in `className`, and the
concrete typeclass instance in `fvar`. Note that the kernel does not care about
this information, since typeclasses are entirely eliminated during elaboration.
-/
structure LocalInstance where
  className : Name
  fvar      : Expr
  deriving Inhabited
goal: Inhabited Lean.LocalInstance

full_name: Lean.LocalInstance.className
code: /--
`LocalInstance` represents a local typeclass instance registered by and for
the elaborator. It stores the name of the typeclass in `className`, and the
concrete typeclass instance in `fvar`. Note that the kernel does not care about
this information, since typeclasses are entirely eliminated during elaboration.
-/
structure LocalInstance where
  className : Name
  fvar      : Expr
  deriving Inhabited
goal: Lean.Name

full_name: Lean.LocalInstance.fvar
code: /--
`LocalInstance` represents a local typeclass instance registered by and for
the elaborator. It stores the name of the typeclass in `className`, and the
concrete typeclass instance in `fvar`. Note that the kernel does not care about
this information, since typeclasses are entirely eliminated during elaboration.
-/
structure LocalInstance where
  className : Name
  fvar      : Expr
  deriving Inhabited
goal: Lean.Expr

full_name: Lean.LocalInstances
code: abbrev LocalInstances 
goal: Type

full_name: Lean.instBEqLocalInstance
code: instance : BEq LocalInstance 
goal: BEq Lean.LocalInstance

full_name: Lean.instHashableLocalInstance
code: instance : Hashable LocalInstance 
goal: Hashable Lean.LocalInstance

full_name: Lean.LocalInstances.erase
code: /-- Remove local instance with the given `fvarId`. Do nothing if `localInsts` does not contain any free variable with id `fvarId`. -/
def LocalInstances.erase (localInsts : LocalInstances) (fvarId : FVarId) : LocalInstances 
goal: Lean.LocalInstances

full_name: Lean.MetavarKind.synthetic
code: /-- A kind for the metavariable that determines its unification behaviour.
For more information see the large comment at the beginning of this file. -/
inductive MetavarKind where
  /-- Normal unification behaviour -/
  | natural
  /-- `isDefEq` avoids assignment -/
  | synthetic
  /-- Never assigned by isDefEq -/
  | syntheticOpaque
  deriving Inhabited, Repr
goal: Lean.MetavarKind

full_name: Lean.instReprMetavarKind
code: /-- A kind for the metavariable that determines its unification behaviour.
For more information see the large comment at the beginning of this file. -/
inductive MetavarKind where
  /-- Normal unification behaviour -/
  | natural
  /-- `isDefEq` avoids assignment -/
  | synthetic
  /-- Never assigned by isDefEq -/
  | syntheticOpaque
  deriving Inhabited, Repr
goal: Repr Lean.MetavarKind

full_name: Lean.MetavarKind
code: /-- A kind for the metavariable that determines its unification behaviour.
For more information see the large comment at the beginning of this file. -/
inductive MetavarKind where
  /-- Normal unification behaviour -/
  | natural
  /-- `isDefEq` avoids assignment -/
  | synthetic
  /-- Never assigned by isDefEq -/
  | syntheticOpaque
  deriving Inhabited, Repr
goal: Type

full_name: Lean.instInhabitedMetavarKind
code: /-- A kind for the metavariable that determines its unification behaviour.
For more information see the large comment at the beginning of this file. -/
inductive MetavarKind where
  /-- Normal unification behaviour -/
  | natural
  /-- `isDefEq` avoids assignment -/
  | synthetic
  /-- Never assigned by isDefEq -/
  | syntheticOpaque
  deriving Inhabited, Repr
goal: Inhabited Lean.MetavarKind

full_name: Lean.MetavarKind.syntheticOpaque
code: /-- A kind for the metavariable that determines its unification behaviour.
For more information see the large comment at the beginning of this file. -/
inductive MetavarKind where
  /-- Normal unification behaviour -/
  | natural
  /-- `isDefEq` avoids assignment -/
  | synthetic
  /-- Never assigned by isDefEq -/
  | syntheticOpaque
  deriving Inhabited, Repr
goal: Lean.MetavarKind

full_name: Lean.MetavarKind.natural
code: /-- A kind for the metavariable that determines its unification behaviour.
For more information see the large comment at the beginning of this file. -/
inductive MetavarKind where
  /-- Normal unification behaviour -/
  | natural
  /-- `isDefEq` avoids assignment -/
  | synthetic
  /-- Never assigned by isDefEq -/
  | syntheticOpaque
  deriving Inhabited, Repr
goal: Lean.MetavarKind

full_name: Lean.MetavarKind.isSyntheticOpaque
code: def MetavarKind.isSyntheticOpaque : MetavarKind → Bool
  
goal: Lean.MetavarKind → Bool

full_name: Lean.MetavarKind.isNatural
code: def MetavarKind.isNatural : MetavarKind → Bool
  
goal: Lean.MetavarKind → Bool

full_name: Lean.MetavarDecl.lctx
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Lean.LocalContext

full_name: Lean.instInhabitedMetavarDecl
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Inhabited Lean.MetavarDecl

full_name: Lean.MetavarDecl.numScopeArgs
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Nat

full_name: Lean.MetavarDecl.kind
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Lean.MetavarKind

full_name: Lean.MetavarDecl.depth
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Nat

full_name: Lean.MetavarDecl.userName
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Lean.Name

full_name: Lean.MetavarDecl.type
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Lean.Expr

full_name: Lean.MetavarDecl.index
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Nat

full_name: Lean.MetavarDecl
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Type

full_name: Lean.MetavarDecl.localInstances
code: /-- Information about a metavariable. -/
structure MetavarDecl where
  /-- A user-friendly name for the metavariable. If anonymous then there is no such name. -/
  userName       : Name := Name.anonymous
  /-- The local context containing the free variables that the mvar is permitted to depend upon. -/
  lctx           : LocalContext
  /-- The type of the metavarible, in the given `lctx`. -/
  type           : Expr
  /--
    The nesting depth of this metavariable. We do not want
    unification subproblems to influence the results of parent
    problems. The depth keeps track of this information and ensures
    that unification subproblems cannot leak information out, by unifying
    based on depth.
  -/
  depth          : Nat
  localInstances : LocalInstances
  kind           : MetavarKind
  /-- See comment at `CheckAssignment` `Meta/ExprDefEq.lean` -/
  numScopeArgs   : Nat := 0
  /-- We use this field to track how old a metavariable is. It is set using a counter at `MetavarContext` -/
  index          : Nat
  deriving Inhabited
goal: Lean.LocalInstances

full_name: Lean.DelayedMetavarAssignment.mvarIdPending
code: /--
  A delayed assignment for a metavariable `?m`. It represents an assignment of the form `?m := (fun fvars => (mkMVar mvarIdPending))`.
  `mvarIdPending` is a `syntheticOpaque` metavariable that has not been synthesized yet. The delayed assignment becomes a real one
  as soon as `mvarIdPending` has been fully synthesized.
  `fvars` are variables in the `mvarIdPending` local context.

  See the comment below `assignDelayedMVar ` for the rationale of delayed assignments.

  Recall that we use a locally nameless approach when dealing with binders. Suppose we are
  trying to synthesize `?n` in the expression `e`, in the context of `(fun x => e)`.
  The metavariable `?n` might depend on the bound variable `x`. However, since we are locally nameless,
  the bound variable `x` is in fact represented by some free variable `fvar_x`. Thus, when we exit
  the scope, we must rebind the value of `fvar_x` in `?n` to the de-bruijn index of the bound variable `x`.
-/
structure DelayedMetavarAssignment where
  fvars         : Array Expr
  mvarIdPending : MVarId
goal: Lean.MVarId

full_name: Lean.DelayedMetavarAssignment
code: /--
  A delayed assignment for a metavariable `?m`. It represents an assignment of the form `?m := (fun fvars => (mkMVar mvarIdPending))`.
  `mvarIdPending` is a `syntheticOpaque` metavariable that has not been synthesized yet. The delayed assignment becomes a real one
  as soon as `mvarIdPending` has been fully synthesized.
  `fvars` are variables in the `mvarIdPending` local context.

  See the comment below `assignDelayedMVar ` for the rationale of delayed assignments.

  Recall that we use a locally nameless approach when dealing with binders. Suppose we are
  trying to synthesize `?n` in the expression `e`, in the context of `(fun x => e)`.
  The metavariable `?n` might depend on the bound variable `x`. However, since we are locally nameless,
  the bound variable `x` is in fact represented by some free variable `fvar_x`. Thus, when we exit
  the scope, we must rebind the value of `fvar_x` in `?n` to the de-bruijn index of the bound variable `x`.
-/
structure DelayedMetavarAssignment where
  fvars         : Array Expr
  mvarIdPending : MVarId
goal: Type

full_name: Lean.DelayedMetavarAssignment.fvars
code: /--
  A delayed assignment for a metavariable `?m`. It represents an assignment of the form `?m := (fun fvars => (mkMVar mvarIdPending))`.
  `mvarIdPending` is a `syntheticOpaque` metavariable that has not been synthesized yet. The delayed assignment becomes a real one
  as soon as `mvarIdPending` has been fully synthesized.
  `fvars` are variables in the `mvarIdPending` local context.

  See the comment below `assignDelayedMVar ` for the rationale of delayed assignments.

  Recall that we use a locally nameless approach when dealing with binders. Suppose we are
  trying to synthesize `?n` in the expression `e`, in the context of `(fun x => e)`.
  The metavariable `?n` might depend on the bound variable `x`. However, since we are locally nameless,
  the bound variable `x` is in fact represented by some free variable `fvar_x`. Thus, when we exit
  the scope, we must rebind the value of `fvar_x` in `?n` to the de-bruijn index of the bound variable `x`.
-/
structure DelayedMetavarAssignment where
  fvars         : Array Expr
  mvarIdPending : MVarId
goal: Array Lean.Expr

full_name: Lean.MetavarContext
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Type

full_name: Lean.MetavarContext.levelAssignDepth
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Nat

full_name: Lean.MetavarContext.eAssignment
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Lean.PersistentHashMap Lean.MVarId Lean.Expr

full_name: Lean.MetavarContext.dAssignment
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Lean.PersistentHashMap Lean.MVarId Lean.DelayedMetavarAssignment

full_name: Lean.MetavarContext.depth
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Nat

full_name: Lean.MetavarContext.lAssignment
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Lean.PersistentHashMap Lean.LMVarId Lean.Level

full_name: Lean.MetavarContext.decls
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Lean.PersistentHashMap Lean.MVarId Lean.MetavarDecl

full_name: Lean.MetavarContext.userNames
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Lean.PersistentHashMap Lean.Name Lean.MVarId

full_name: Lean.MetavarContext.lDepth
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Lean.PersistentHashMap Lean.LMVarId Nat

full_name: Lean.MetavarContext.mvarCounter
code: /-- The metavariable context is a set of metavariable declarations and their assignments.

For more information on specifics see the comment in the file that `MetavarContext` is defined in.
-/
structure MetavarContext where
  /-- Depth is used to control whether an mvar can be assigned in unification. -/
  depth          : Nat := 0
  /-- At what depth level mvars can be assigned. -/
  levelAssignDepth : Nat := 0
  /-- Counter for setting the field `index` at `MetavarDecl` -/
  mvarCounter    : Nat := 0
  lDepth         : PersistentHashMap LMVarId Nat := {}
  /-- Metavariable declarations. -/
  decls          : PersistentHashMap MVarId MetavarDecl := {}
  /-- Index mapping user-friendly names to ids. -/
  userNames      : PersistentHashMap Name MVarId := {}
  /-- Assignment table for universe level metavariables.-/
  lAssignment    : PersistentHashMap LMVarId Level := {}
  /-- Assignment table for expression metavariables.-/
  eAssignment    : PersistentHashMap MVarId Expr := {}
  /-- Assignment table for delayed abstraction metavariables.
  For more information about delayed abstraction, see the docstring for `DelayedMetavarAssignment`. -/
  dAssignment    : PersistentHashMap MVarId DelayedMetavarAssignment := {}
goal: Nat

full_name: Lean.MonadMCtx.getMCtx
code: /-- A monad with a stateful metavariable context, defining `getMCtx` and `modifyMCtx`. -/
class MonadMCtx (m : Type → Type) where
  getMCtx    : m MetavarContext
  modifyMCtx : (MetavarContext → MetavarContext) → m Unit
goal: m Lean.MetavarContext

full_name: Lean.MonadMCtx.modifyMCtx
code: /-- A monad with a stateful metavariable context, defining `getMCtx` and `modifyMCtx`. -/
class MonadMCtx (m : Type → Type) where
  getMCtx    : m MetavarContext
  modifyMCtx : (MetavarContext → MetavarContext) → m Unit
goal: (Lean.MetavarContext → Lean.MetavarContext) → m Unit

full_name: Lean.MonadMCtx
code: /-- A monad with a stateful metavariable context, defining `getMCtx` and `modifyMCtx`. -/
class MonadMCtx (m : Type → Type) where
  getMCtx    : m MetavarContext
  modifyMCtx : (MetavarContext → MetavarContext) → m Unit
goal: Type

full_name: Lean.instMonadMCtxStateMMetavarContext
code: instance : MonadMCtx (StateM MetavarContext) 
goal: Lean.MonadMCtx (StateM Lean.MetavarContext)

full_name: Lean.instMonadMCtxOfMonadLift
code: @[always_inline]
instance (m n) [MonadLift m n] [MonadMCtx m] : MonadMCtx n 
goal: Lean.MonadMCtx n

full_name: Lean.setMCtx
code: abbrev setMCtx [MonadMCtx m] (mctx : MetavarContext) : m Unit 
goal: m Unit

full_name: Lean.getLevelMVarAssignment?
code: abbrev getLevelMVarAssignment? [Monad m] [MonadMCtx m] (mvarId : LMVarId) : m (Option Level) 
goal: m (Option Lean.Level)

full_name: Lean.MetavarContext.getExprAssignmentCore?
code: def MetavarContext.getExprAssignmentCore? (m : MetavarContext) (mvarId : MVarId) : Option Expr 
goal: Option Lean.Expr

full_name: Lean.getExprMVarAssignment?
code: def getExprMVarAssignment? [Monad m] [MonadMCtx m] (mvarId : MVarId) : m (Option Expr) 
goal: m (Option Lean.Expr)

full_name: Lean.MetavarContext.getDelayedMVarAssignmentCore?
code: def MetavarContext.getDelayedMVarAssignmentCore? (mctx : MetavarContext) (mvarId : MVarId) : Option DelayedMetavarAssignment 
goal: Option Lean.DelayedMetavarAssignment

full_name: Lean.getDelayedMVarAssignment?
code: def getDelayedMVarAssignment? [Monad m] [MonadMCtx m] (mvarId : MVarId) : m (Option DelayedMetavarAssignment) 
goal: m (Option Lean.DelayedMetavarAssignment)

full_name: Lean.getDelayedMVarRoot
code: /-- Given a sequence of delayed assignments
   ```
   mvarId₁ := mvarId₂ ...;
   ...
   mvarIdₙ := mvarId_root ...  -- where `mvarId_root` is not delayed assigned
   ```
   in `mctx`, `getDelayedRoot mctx mvarId₁` return `mvarId_root`.
   If `mvarId₁` is not delayed assigned then return `mvarId₁` -/
partial def getDelayedMVarRoot [Monad m] [MonadMCtx m] (mvarId : MVarId) : m MVarId 
goal: m Lean.MVarId

full_name: Lean.isLevelMVarAssigned
code: def isLevelMVarAssigned [Monad m] [MonadMCtx m] (mvarId : LMVarId) : m Bool 
goal: m Bool

full_name: Lean.MVarId.isAssigned
code: /-- Return `true` if the give metavariable is already assigned. -/
def _root_.Lean.MVarId.isAssigned [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Bool 
goal: m Bool

full_name: Lean.isExprMVarAssigned
code: @[deprecated MVarId.isAssigned (since := "2022-07-15")]
def isExprMVarAssigned [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Bool 
goal: m Bool

full_name: Lean.MVarId.isDelayedAssigned
code: def _root_.Lean.MVarId.isDelayedAssigned [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Bool 
goal: m Bool

full_name: Lean.isMVarDelayedAssigned
code: @[deprecated MVarId.isDelayedAssigned (since := "2022-07-15")]
def isMVarDelayedAssigned [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Bool 
goal: m Bool

full_name: Lean.MVarId.isAssignedOrDelayedAssigned
code: /--
Check whether a metavariable is assigned or delayed-assigned. A
delayed-assigned metavariable is already 'solved' but the solution cannot be
substituted yet because we have to wait for some other metavariables to be
assigned first. So in many situations you want to treat a delayed-assigned
metavariable as assigned.
-/
def _root_.Lean.MVarId.isAssignedOrDelayedAssigned [Monad m] [MonadMCtx m] (mvarId : MVarId) :
    m Bool 
goal: m Bool

full_name: Lean.isLevelMVarAssignable
code: def isLevelMVarAssignable [Monad m] [MonadMCtx m] (mvarId : LMVarId) : m Bool 
goal: m Bool

full_name: Lean.MetavarContext.getDecl
code: def MetavarContext.getDecl (mctx : MetavarContext) (mvarId : MVarId) : MetavarDecl 
goal: Lean.MetavarDecl

full_name: Lean.MVarId.isAssignable
code: def _root_.Lean.MVarId.isAssignable [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Bool 
goal: m Bool

full_name: Lean.isExprMVarAssignable
code: @[deprecated MVarId.isAssignable (since := "2022-07-15")]
def isExprMVarAssignable [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Bool 
goal: m Bool

full_name: Lean.hasAssignedLevelMVar
code: /-- Return true iff the given level contains an assigned metavariable. -/
def hasAssignedLevelMVar [Monad m] [MonadMCtx m] : Level → m Bool
  
goal: Lean.Level → m Bool

full_name: Lean.hasAssignedMVar
code: /-- Return `true` iff expression contains assigned (level/expr) metavariables or delayed assigned mvars -/
def hasAssignedMVar [Monad m] [MonadMCtx m] : Expr → m Bool
  
goal: Lean.Expr → m Bool

full_name: Lean.hasAssignableLevelMVar
code: /-- Return true iff the given level contains a metavariable that can be assigned. -/
def hasAssignableLevelMVar [Monad m] [MonadMCtx m] : Level → m Bool
  
goal: Lean.Level → m Bool

full_name: Lean.hasAssignableMVar
code: /-- Return `true` iff expression contains a metavariable that can be assigned. -/
def hasAssignableMVar [Monad m] [MonadMCtx m] : Expr → m Bool
  
goal: Lean.Expr → m Bool

full_name: Lean.assignLevelMVar
code: /--
  Add `mvarId := u` to the universe metavariable assignment.
  This method does not check whether `mvarId` is already assigned, nor it checks whether
  a cycle is being introduced.
  This is a low-level API, and it is safer to use `isLevelDefEq (mkLevelMVar mvarId) u`.
-/
def assignLevelMVar [MonadMCtx m] (mvarId : LMVarId) (val : Level) : m Unit 
goal: m Unit

full_name: Lean.MVarId.assign
code: /--
Add `mvarId := x` to the metavariable assignment.
This method does not check whether `mvarId` is already assigned, nor it checks whether
a cycle is being introduced, or whether the expression has the right type.
This is a low-level API, and it is safer to use `isDefEq (mkMVar mvarId) x`.
-/
def _root_.Lean.MVarId.assign [MonadMCtx m] (mvarId : MVarId) (val : Expr) : m Unit 
goal: m Unit

full_name: Lean.assignExprMVar
code: @[deprecated MVarId.assign (since := "2022-07-15")]
def assignExprMVar [MonadMCtx m] (mvarId : MVarId) (val : Expr) : m Unit 
goal: m Unit

full_name: Lean.assignDelayedMVar
code: /--
Add a delayed assignment for the given metavariable. You must make sure that
the metavariable is not already assigned or delayed-assigned.
-/
def assignDelayedMVar [MonadMCtx m] (mvarId : MVarId) (fvars : Array Expr) (mvarIdPending : MVarId) : m Unit 
goal: m Unit

full_name: Lean.instantiateLevelMVars
code: partial def instantiateLevelMVars [Monad m] [MonadMCtx m] : Level → m Level
  
goal: Lean.Level → m Lean.Level

full_name: Lean.instantiateExprMVars
code: /-- instantiateExprMVars main function -/
partial def instantiateExprMVars [Monad m] [MonadMCtx m] [STWorld ω m] [MonadLiftT (ST ω) m] (e : Expr) : MonadCacheT ExprStructEq Expr m Expr 
goal: Lean.MonadCacheT Lean.ExprStructEq Lean.Expr m Lean.Expr

full_name: Lean.instMonadMCtxStateRefT'MetavarContextST
code: instance : MonadMCtx (StateRefT MetavarContext (ST ω)) 
goal: Lean.MonadMCtx (StateRefT' ω Lean.MetavarContext (ST ω))

full_name: Lean.instantiateMVarsCore
code: def instantiateMVarsCore (mctx : MetavarContext) (e : Expr) : Expr × MetavarContext 
goal: Lean.Expr × Lean.MetavarContext

full_name: Lean.instantiateMVars
code: def instantiateMVars [Monad m] [MonadMCtx m] (e : Expr) : m Expr 
goal: m Lean.Expr

full_name: Lean.instantiateLCtxMVars
code: def instantiateLCtxMVars [Monad m] [MonadMCtx m] (lctx : LocalContext) : m LocalContext 
goal: m Lean.LocalContext

full_name: Lean.instantiateMVarDeclMVars
code: def instantiateMVarDeclMVars [Monad m] [MonadMCtx m] (mvarId : MVarId) : m Unit 
goal: m Unit

full_name: Lean.instantiateLocalDeclMVars
code: def instantiateLocalDeclMVars [Monad m] [MonadMCtx m] (localDecl : LocalDecl) : m LocalDecl 
goal: m Lean.LocalDecl

full_name: Lean.DependsOn.State
code: structure State where
  visited : ExprSet := {}
  mctx    : MetavarContext
goal: Type

full_name: Lean.DependsOn.State.mctx
code: structure State where
  visited : ExprSet := {}
  mctx    : MetavarContext
goal: Lean.MetavarContext

full_name: Lean.DependsOn.State.visited
code: structure State where
  visited : ExprSet := {}
  mctx    : MetavarContext
goal: Lean.ExprSet

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.DependsOn.M
code: private abbrev M 
goal: Type

full_name: Lean.DependsOn.instMonadMCtxM
code: instance : MonadMCtx M 
goal: Lean.MonadMCtx Lean.DependsOn.M

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.DependsOn.shouldVisit
code: private def shouldVisit (e : Expr) : M Bool 
goal: Lean.DependsOn.M Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.DependsOn.dep.visitMain
code: @[specialize] private partial def dep (pf : FVarId → Bool) (pm : MVarId →  Bool) (e : Expr) : M Bool 
goal: Lean.Expr → Lean.DependsOn.M Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.DependsOn.dep.visit
code: @[specialize] private partial def dep (pf : FVarId → Bool) (pm : MVarId →  Bool) (e : Expr) : M Bool 
goal: Lean.DependsOn.M Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.DependsOn.dep
code: @[specialize] private partial def dep (pf : FVarId → Bool) (pm : MVarId →  Bool) (e : Expr) : M Bool 
goal: Lean.DependsOn.M Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.DependsOn.dep.visitApp
code: @[specialize] private partial def dep (pf : FVarId → Bool) (pm : MVarId →  Bool) (e : Expr) : M Bool 
goal: Lean.Expr → Lean.DependsOn.M Bool

full_name: Lean.DependsOn.main
code: @[inline] partial def main (pf : FVarId → Bool) (pm : MVarId → Bool) (e : Expr) : M Bool 
goal: Lean.DependsOn.M Bool

full_name: Lean.findExprDependsOn
code: /--
  Return `true` iff `e` depends on a free variable `x` s.t. `pf x` is `true`, or an unassigned metavariable `?m` s.t. `pm ?m` is true.
  For each metavariable `?m` (that does not satisfy `pm` occurring in `x`
  1- If `?m := t`, then we visit `t` looking for `x`
  2- If `?m` is unassigned, then we consider the worst case and check whether `x` is in the local context of `?m`.
     This case is a "may dependency". That is, we may assign a term `t` to `?m` s.t. `t` contains `x`. -/
@[inline] def findExprDependsOn [Monad m] [MonadMCtx m] (e : Expr) (pf : FVarId → Bool := fun _ => false) (pm : MVarId → Bool := fun _ => false) : m Bool 
goal: m Bool

full_name: Lean.findLocalDeclDependsOn
code: /--
  Similar to `findExprDependsOn`, but checks the expressions in the given local declaration
  depends on a free variable `x` s.t. `pf x` is `true` or an unassigned metavariable `?m` s.t. `pm ?m` is true. -/
@[inline] def findLocalDeclDependsOn [Monad m] [MonadMCtx m] (localDecl : LocalDecl) (pf : FVarId → Bool := fun _ => false) (pm : MVarId → Bool := fun _ => false) : m Bool 
goal: m Bool

full_name: Lean.exprDependsOn
code: def exprDependsOn [Monad m] [MonadMCtx m] (e : Expr) (fvarId : FVarId) : m Bool 
goal: m Bool

full_name: Lean.dependsOn
code: /-- Return true iff `e` depends on the free variable `fvarId` -/
def dependsOn [Monad m] [MonadMCtx m] (e : Expr) (fvarId : FVarId) : m Bool 
goal: m Bool

full_name: Lean.localDeclDependsOn
code: /-- Return true iff `localDecl` depends on the free variable `fvarId` -/
def localDeclDependsOn [Monad m] [MonadMCtx m] (localDecl : LocalDecl) (fvarId : FVarId) : m Bool 
goal: m Bool

full_name: Lean.exprDependsOn'
code: /-- Similar to `exprDependsOn`, but `x` can be a free variable or an unassigned metavariable. -/
def exprDependsOn' [Monad m] [MonadMCtx m] (e : Expr) (x : Expr) : m Bool 
goal: m Bool

full_name: Lean.localDeclDependsOn'
code: /-- Similar to `localDeclDependsOn`, but `x` can be a free variable or an unassigned metavariable. -/
def localDeclDependsOn' [Monad m] [MonadMCtx m] (localDecl : LocalDecl) (x : Expr) : m Bool 
goal: m Bool

full_name: Lean.dependsOnPred
code: /-- Return true iff `e` depends on a free variable `x` s.t. `pf x`, or an unassigned metavariable `?m` s.t. `pm ?m` is true. -/
def dependsOnPred [Monad m] [MonadMCtx m] (e : Expr) (pf : FVarId → Bool := fun _ => false) (pm : MVarId → Bool := fun _ => false) : m Bool 
goal: m Bool

full_name: Lean.localDeclDependsOnPred
code: /-- Return true iff the local declaration `localDecl` depends on a free variable `x` s.t. `pf x`, an unassigned metavariable `?m` s.t. `pm ?m` is true. -/
def localDeclDependsOnPred [Monad m] [MonadMCtx m] (localDecl : LocalDecl) (pf : FVarId → Bool := fun _ => false) (pm : MVarId → Bool := fun _ => false) : m Bool 
goal: m Bool

full_name: Lean.MetavarContext.instInhabited
code: instance : Inhabited MetavarContext 
goal: Inhabited Lean.MetavarContext

full_name: Lean.MetavarContext.mkMetavarContext
code: @[export lean_mk_metavar_ctx]
def mkMetavarContext : Unit → MetavarContext 
goal: Unit → Lean.MetavarContext

full_name: Lean.MetavarContext.addExprMVarDecl
code: /-- Low level API for adding/declaring metavariable declarations.
   It is used to implement actions in the monads `MetaM`, `ElabM` and `TacticM`.
   It should not be used directly since the argument `(mvarId : MVarId)` is assumed to be "unique". -/
def addExprMVarDecl (mctx : MetavarContext)
    (mvarId : MVarId)
    (userName : Name)
    (lctx : LocalContext)
    (localInstances : LocalInstances)
    (type : Expr)
    (kind : MetavarKind := MetavarKind.natural)
    (numScopeArgs : Nat := 0) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.addExprMVarDeclExp
code: def addExprMVarDeclExp (mctx : MetavarContext) (mvarId : MVarId) (userName : Name) (lctx : LocalContext) (localInstances : LocalInstances)
    (type : Expr) (kind : MetavarKind) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.addLevelMVarDecl
code: /-- Low level API for adding/declaring universe level metavariable declarations.
   It is used to implement actions in the monads `MetaM`, `ElabM` and `TacticM`.
   It should not be used directly since the argument `(mvarId : MVarId)` is assumed to be "unique". -/
def addLevelMVarDecl (mctx : MetavarContext) (mvarId : LMVarId) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.findDecl?
code: def findDecl? (mctx : MetavarContext) (mvarId : MVarId) : Option MetavarDecl 
goal: Option Lean.MetavarDecl

full_name: Lean.MetavarContext.findUserName?
code: def findUserName? (mctx : MetavarContext) (userName : Name) : Option MVarId 
goal: Option Lean.MVarId

full_name: Lean.MetavarContext.modifyExprMVarDecl
code: /--
Modify the declaration of a metavariable. If the metavariable is not declared,
the `MetavarContext` is returned unchanged.

You must ensure that the modification is legal. In particular, expressions may
only be replaced with defeq expressions.
-/
def modifyExprMVarDecl (mctx : MetavarContext) (mvarId : MVarId)
    (f : MetavarDecl → MetavarDecl) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.setMVarKind
code: def setMVarKind (mctx : MetavarContext) (mvarId : MVarId) (kind : MetavarKind) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.setMVarUserName
code: /--
  Set the metavariable user facing name.
-/
def setMVarUserName (mctx : MetavarContext) (mvarId : MVarId) (userName : Name) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.setMVarUserNameTemporarily
code: /--
  Low-level version of `setMVarUserName`.
  It does not update the table `userNames`. Thus, `findUserName?` cannot see the modification.
  It is meant for `mkForallFVars'` where we temporarily set the user facing name of metavariables to get more
  meaningful binder names.
-/
def setMVarUserNameTemporarily (mctx : MetavarContext) (mvarId : MVarId) (userName : Name) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.setMVarType
code: /-- Update the type of the given metavariable. This function assumes the new type is
   definitionally equal to the current one -/
def setMVarType (mctx : MetavarContext) (mvarId : MVarId) (type : Expr) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.modifyExprMVarLCtx
code: /--
Modify the local context of a metavariable. If the metavariable is not declared,
the `MetavarContext` is returned unchanged.

You must ensure that the modification is legal. In particular, expressions may
only be replaced with defeq expressions.
-/
def modifyExprMVarLCtx (mctx : MetavarContext) (mvarId : MVarId)
    (f : LocalContext → LocalContext) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.setFVarKind
code: /--
Set the kind of an fvar. If the given metavariable is not declared or the
given fvar doesn't exist in its context, the `MetavarContext` is returned
unchanged.
-/
def setFVarKind (mctx : MetavarContext) (mvarId : MVarId) (fvarId : FVarId)
    (kind : LocalDeclKind) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.setFVarBinderInfo
code: /--
Set the `BinderInfo` of an fvar. If the given metavariable is not declared or
the given fvar doesn't exist in its context, the `MetavarContext` is returned
unchanged.
-/
def setFVarBinderInfo (mctx : MetavarContext) (mvarId : MVarId)
    (fvarId : FVarId) (bi : BinderInfo) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.findLevelDepth?
code: def findLevelDepth? (mctx : MetavarContext) (mvarId : LMVarId) : Option Nat 
goal: Option Nat

full_name: Lean.MetavarContext.getLevelDepth
code: def getLevelDepth (mctx : MetavarContext) (mvarId : LMVarId) : Nat 
goal: Nat

full_name: Lean.MetavarContext.isAnonymousMVar
code: def isAnonymousMVar (mctx : MetavarContext) (mvarId : MVarId) : Bool 
goal: Bool

full_name: Lean.MetavarContext.incDepth
code: def incDepth (mctx : MetavarContext) (allowLevelAssignments := false) : MetavarContext 
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.instMonadMCtxStateRefT'ST
code: instance : MonadMCtx (StateRefT MetavarContext (ST ω)) 
goal: Lean.MonadMCtx (StateRefT' ω Lean.MetavarContext (ST ω))

full_name: Lean.MetavarContext.MkBinding.Exception.revertFailure
code: inductive Exception where
  | revertFailure (mctx : MetavarContext) (lctx : LocalContext) (toRevert : Array Expr) (varName : String)
goal: Lean.MetavarContext.MkBinding.Exception

full_name: Lean.MetavarContext.MkBinding.Exception
code: inductive Exception where
  | revertFailure (mctx : MetavarContext) (lctx : LocalContext) (toRevert : Array Expr) (varName : String)
goal: Type

full_name: Lean.MetavarContext.MkBinding.instToStringException
code: instance : ToString Exception 
goal: ToString Lean.MetavarContext.MkBinding.Exception

full_name: Lean.MetavarContext.MkBinding.State
code: /--
 `MkBinding` and `elimMVarDepsAux` are mutually recursive, but `cache` is only used at `elimMVarDepsAux`.
  We use a single state object for convenience.

  We have a `NameGenerator` because we need to generate fresh auxiliary metavariables. -/
structure State where
  mctx           : MetavarContext
  nextMacroScope : MacroScope
  ngen           : NameGenerator
  cache          : HashMap ExprStructEq Expr := {}
goal: Type

full_name: Lean.MetavarContext.MkBinding.State.cache
code: /--
 `MkBinding` and `elimMVarDepsAux` are mutually recursive, but `cache` is only used at `elimMVarDepsAux`.
  We use a single state object for convenience.

  We have a `NameGenerator` because we need to generate fresh auxiliary metavariables. -/
structure State where
  mctx           : MetavarContext
  nextMacroScope : MacroScope
  ngen           : NameGenerator
  cache          : HashMap ExprStructEq Expr := {}
goal: Lean.HashMap Lean.ExprStructEq Lean.Expr

full_name: Lean.MetavarContext.MkBinding.State.nextMacroScope
code: /--
 `MkBinding` and `elimMVarDepsAux` are mutually recursive, but `cache` is only used at `elimMVarDepsAux`.
  We use a single state object for convenience.

  We have a `NameGenerator` because we need to generate fresh auxiliary metavariables. -/
structure State where
  mctx           : MetavarContext
  nextMacroScope : MacroScope
  ngen           : NameGenerator
  cache          : HashMap ExprStructEq Expr := {}
goal: Lean.MacroScope

full_name: Lean.MetavarContext.MkBinding.State.mctx
code: /--
 `MkBinding` and `elimMVarDepsAux` are mutually recursive, but `cache` is only used at `elimMVarDepsAux`.
  We use a single state object for convenience.

  We have a `NameGenerator` because we need to generate fresh auxiliary metavariables. -/
structure State where
  mctx           : MetavarContext
  nextMacroScope : MacroScope
  ngen           : NameGenerator
  cache          : HashMap ExprStructEq Expr := {}
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.MkBinding.State.ngen
code: /--
 `MkBinding` and `elimMVarDepsAux` are mutually recursive, but `cache` is only used at `elimMVarDepsAux`.
  We use a single state object for convenience.

  We have a `NameGenerator` because we need to generate fresh auxiliary metavariables. -/
structure State where
  mctx           : MetavarContext
  nextMacroScope : MacroScope
  ngen           : NameGenerator
  cache          : HashMap ExprStructEq Expr := {}
goal: Lean.NameGenerator

full_name: Lean.MetavarContext.MkBinding.Context.binderInfoForMVars
code: structure Context where
  mainModule         : Name
  preserveOrder      : Bool
  /-- When creating binders for abstracted metavariables, we use the following `BinderInfo`. -/
  binderInfoForMVars : BinderInfo := BinderInfo.implicit
  /-- Set of unassigned metavariables being abstracted. -/
  mvarIdsToAbstract  : MVarIdSet := {}
goal: Lean.BinderInfo

full_name: Lean.MetavarContext.MkBinding.Context.mainModule
code: structure Context where
  mainModule         : Name
  preserveOrder      : Bool
  /-- When creating binders for abstracted metavariables, we use the following `BinderInfo`. -/
  binderInfoForMVars : BinderInfo := BinderInfo.implicit
  /-- Set of unassigned metavariables being abstracted. -/
  mvarIdsToAbstract  : MVarIdSet := {}
goal: Lean.Name

full_name: Lean.MetavarContext.MkBinding.Context
code: structure Context where
  mainModule         : Name
  preserveOrder      : Bool
  /-- When creating binders for abstracted metavariables, we use the following `BinderInfo`. -/
  binderInfoForMVars : BinderInfo := BinderInfo.implicit
  /-- Set of unassigned metavariables being abstracted. -/
  mvarIdsToAbstract  : MVarIdSet := {}
goal: Type

full_name: Lean.MetavarContext.MkBinding.Context.preserveOrder
code: structure Context where
  mainModule         : Name
  preserveOrder      : Bool
  /-- When creating binders for abstracted metavariables, we use the following `BinderInfo`. -/
  binderInfoForMVars : BinderInfo := BinderInfo.implicit
  /-- Set of unassigned metavariables being abstracted. -/
  mvarIdsToAbstract  : MVarIdSet := {}
goal: Bool

full_name: Lean.MetavarContext.MkBinding.Context.mvarIdsToAbstract
code: structure Context where
  mainModule         : Name
  preserveOrder      : Bool
  /-- When creating binders for abstracted metavariables, we use the following `BinderInfo`. -/
  binderInfoForMVars : BinderInfo := BinderInfo.implicit
  /-- Set of unassigned metavariables being abstracted. -/
  mvarIdsToAbstract  : MVarIdSet := {}
goal: Lean.MVarIdSet

full_name: Lean.MetavarContext.MkBinding.MCore
code: abbrev MCore 
goal: Type

full_name: Lean.MetavarContext.MkBinding.M
code: abbrev M     
goal: Type

full_name: Lean.MetavarContext.MkBinding.instMonadMCtxM
code: instance : MonadMCtx M 
goal: Lean.MonadMCtx Lean.MetavarContext.MkBinding.M

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.MetavarContext.MkBinding.mkFreshBinderName
code: private def mkFreshBinderName (n : Name := `x) : M Name 
goal: Lean.MetavarContext.MkBinding.M Lean.Name

full_name: Lean.MetavarContext.MkBinding.preserveOrder
code: def preserveOrder : M Bool 
goal: Lean.MetavarContext.MkBinding.M Bool

full_name: Lean.MetavarContext.MkBinding.instMonadHashMapCacheAdapterExprStructEqExprM
code: instance : MonadHashMapCacheAdapter ExprStructEq Expr M 
goal: Lean.MonadHashMapCacheAdapter Lean.ExprStructEq Lean.Expr Lean.MetavarContext.MkBinding.M

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.MetavarContext.MkBinding.getLocalDeclWithSmallestIdx
code: /-- Return the local declaration of the free variable `x` in `xs` with the smallest index -/
private def getLocalDeclWithSmallestIdx (lctx : LocalContext) (xs : Array Expr) : LocalDecl 
goal: Lean.LocalDecl

full_name: Lean.MetavarContext.MkBinding.collectForwardDeps
code: /--
  Given `toRevert` an array of free variables s.t. `lctx` contains their declarations,
  return a new array of free variables that contains `toRevert` and all variables
  in `lctx` that may depend on `toRevert`.

  Remark: the result is sorted by `LocalDecl` indices.

  Remark: We used to throw an `Exception.revertFailure` exception when an auxiliary declaration
  had to be reversed. Recall that auxiliary declarations are created when compiling (mutually)
  recursive definitions. The `revertFailure` due to auxiliary declaration dependency was originally
  introduced in Lean3 to address issue <https://github.com/leanprover/lean/issues/1258>.

  In Lean4, this solution is not satisfactory because all definitions/theorems are potentially
  recursive. So, even a simple (incomplete) definition such as
  ```
  variables {α : Type} in
  def f (a : α) : List α :=
  _
  ```
  would trigger the `Exception.revertFailure` exception. In the definition above,
  the elaborator creates the auxiliary definition `f : {α : Type} → List α`.
  The `_` is elaborated as a new fresh variable `?m` that contains `α : Type`, `a : α`, and `f : α → List α` in its context,
  When we try to create the lambda `fun {α : Type} (a : α) => ?m`, we first need to create
  an auxiliary `?n` which does not contain `α` and `a` in its context. That is,
  we create the metavariable `?n : {α : Type} → (a : α) → (f : α → List α) → List α`,
  add the delayed assignment `?n #[α, a, f] := ?m`, and create the lambda
  `fun {α : Type} (a : α) => ?n α a f`.

  See `elimMVarDeps` for more information.

  If we kept using the Lean3 approach, we would get the `Exception.revertFailure` exception because we are
  reverting the auxiliary definition `f`.

  Note that <https://github.com/leanprover/lean/issues/1258> is not an issue in Lean4 because
  we have changed how we compile recursive definitions.
-/
def collectForwardDeps (lctx : LocalContext) (toRevert : Array Expr) : M (Array Expr) 
goal: Lean.MetavarContext.MkBinding.M (Array Lean.Expr)

full_name: Lean.MetavarContext.MkBinding.reduceLocalContext
code: /-- Create a new `LocalContext` by removing the free variables in `toRevert` from `lctx`.
    We use this function when we create auxiliary metavariables at `elimMVarDepsAux`. -/
def reduceLocalContext (lctx : LocalContext) (toRevert : Array Expr) : LocalContext 
goal: Lean.LocalContext

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.MetavarContext.MkBinding.getInScope
code: /-- Return free variables in `xs` that are in the local context `lctx` -/
private def getInScope (lctx : LocalContext) (xs : Array Expr) : Array Expr 
goal: Array Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.MetavarContext.MkBinding.withFreshCache
code: /-- Execute `x` with an empty cache, and then restore the original cache. -/
@[inline] private def withFreshCache (x : M α) : M α 
goal: Lean.MetavarContext.MkBinding.M α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.MetavarContext.MkBinding.mkMVarApp
code: /--
  Create an application `mvar ys` where `ys` are the free variables.
  See "Gruesome details" in the beginning of the file for understanding
  how let-decl free variables are handled. -/
private def mkMVarApp (lctx : LocalContext) (mvar : Expr) (xs : Array Expr) (kind : MetavarKind) : Expr 
goal: Lean.Expr

full_name: Lean.MetavarContext.MkBinding.elimMVarDeps
code: partial def elimMVarDeps (xs : Array Expr) (e : Expr) : M Expr 
goal: Lean.MetavarContext.MkBinding.M Lean.Expr

full_name: Lean.MetavarContext.MkBinding.revert
code: /--
  Revert the variables `xs` from the local context of `mvarId`, returning
  an expression representing the (new) reverted metavariable and the list of
  variables that were actually reverted (this list will include any forward dependencies).

  See details in the comment at the top of the file.
-/
partial def revert (xs : Array Expr) (mvarId : MVarId) : M (Expr × Array Expr) 
goal: Lean.MetavarContext.MkBinding.M (Lean.Expr × Array Lean.Expr)

full_name: Lean.MetavarContext.MkBinding.abstractRange
code: /--
  Similar to `Expr.abstractRange`, but handles metavariables correctly.
  It uses `elimMVarDeps` to ensure `e` and the type of the free variables `xs` do not
  contain a metavariable `?m` s.t. local context of `?m` contains a free variable in `xs`.
-/
@[inline] def abstractRange (xs : Array Expr) (i : Nat) (e : Expr) : M Expr 
goal: Lean.MetavarContext.MkBinding.M Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.MetavarContext.0.Lean.MetavarContext.MkBinding.mkLambda'
code: private def mkLambda' (x : Name) (bi : BinderInfo) (t : Expr) (b : Expr) (etaReduce : Bool) : Expr 
goal: Lean.Expr

full_name: Lean.MetavarContext.MkBinding.mkBinding
code: /--
  Similar to `LocalContext.mkBinding`, but handles metavariables correctly.
  If `usedOnly == true` then `forall` and `lambda` expressions are created only for used variables.
  If `usedLetOnly == true` then `let` expressions are created only for used (let-) variables. -/
@[specialize] def mkBinding (isLambda : Bool) (lctx : LocalContext) (xs : Array Expr) (e : Expr) (usedOnly : Bool) (usedLetOnly : Bool) (etaReduce : Bool) : M Expr 
goal: Lean.MetavarContext.MkBinding.M Lean.Expr

full_name: Lean.MetavarContext.MkBindingM.Context.mainModule
code: structure MkBindingM.Context where
  mainModule : Name
  lctx       : LocalContext
goal: Lean.Name

full_name: Lean.MetavarContext.MkBindingM.Context
code: structure MkBindingM.Context where
  mainModule : Name
  lctx       : LocalContext
goal: Type

full_name: Lean.MetavarContext.MkBindingM.Context.lctx
code: structure MkBindingM.Context where
  mainModule : Name
  lctx       : LocalContext
goal: Lean.LocalContext

full_name: Lean.MetavarContext.MkBindingM
code: abbrev MkBindingM 
goal: Type

full_name: Lean.MetavarContext.elimMVarDeps
code: def elimMVarDeps (xs : Array Expr) (e : Expr) (preserveOrder : Bool) : MkBindingM Expr 
goal: Lean.MetavarContext.MkBindingM Lean.Expr

full_name: Lean.MetavarContext.revert
code: def revert (xs : Array Expr) (mvarId : MVarId) (preserveOrder : Bool) : MkBindingM (Expr × Array Expr) 
goal: Lean.MetavarContext.MkBindingM (Lean.Expr × Array Lean.Expr)

full_name: Lean.MetavarContext.mkBinding
code: def mkBinding (isLambda : Bool) (xs : Array Expr) (e : Expr) (usedOnly : Bool := false) (usedLetOnly : Bool := true) (etaReduce := false) (binderInfoForMVars := BinderInfo.implicit) : MkBindingM Expr 
goal: Lean.MetavarContext.MkBindingM Lean.Expr

full_name: Lean.MetavarContext.mkLambda
code: @[inline] def mkLambda (xs : Array Expr) (e : Expr) (usedOnly : Bool := false) (usedLetOnly : Bool := true) (etaReduce := false) (binderInfoForMVars := BinderInfo.implicit) : MkBindingM Expr 
goal: Lean.MetavarContext.MkBindingM Lean.Expr

full_name: Lean.MetavarContext.mkForall
code: @[inline] def mkForall (xs : Array Expr) (e : Expr) (usedOnly : Bool := false) (usedLetOnly : Bool := true) (binderInfoForMVars := BinderInfo.implicit) : MkBindingM Expr 
goal: Lean.MetavarContext.MkBindingM Lean.Expr

full_name: Lean.MetavarContext.abstractRange
code: @[inline] def abstractRange (e : Expr) (n : Nat) (xs : Array Expr) : MkBindingM Expr 
goal: Lean.MetavarContext.MkBindingM Lean.Expr

full_name: Lean.MetavarContext.collectForwardDeps
code: @[inline] def collectForwardDeps (toRevert : Array Expr) (preserveOrder : Bool) : MkBindingM (Array Expr) 
goal: Lean.MetavarContext.MkBindingM (Array Lean.Expr)

full_name: Lean.MetavarContext.isWellFormed
code: /--
  `isWellFormed lctx e` returns true iff
  - All locals in `e` are declared in `lctx`
  - All metavariables `?m` in `e` have a local context which is a subprefix of `lctx` or are assigned, and the assignment is well-formed. -/
partial def isWellFormed [Monad m] [MonadMCtx m] (lctx : LocalContext) : Expr → m Bool
  
goal: Lean.Expr → m Bool

full_name: Lean.MetavarContext.LevelMVarToParam.Context.paramNamePrefix
code: structure Context where
  paramNamePrefix : Name
  alreadyUsedPred : Name → Bool
  except          : LMVarId → Bool
goal: Lean.Name

full_name: Lean.MetavarContext.LevelMVarToParam.Context.alreadyUsedPred
code: structure Context where
  paramNamePrefix : Name
  alreadyUsedPred : Name → Bool
  except          : LMVarId → Bool
goal: Lean.Name → Bool

full_name: Lean.MetavarContext.LevelMVarToParam.Context
code: structure Context where
  paramNamePrefix : Name
  alreadyUsedPred : Name → Bool
  except          : LMVarId → Bool
goal: Type

full_name: Lean.MetavarContext.LevelMVarToParam.Context.except
code: structure Context where
  paramNamePrefix : Name
  alreadyUsedPred : Name → Bool
  except          : LMVarId → Bool
goal: Lean.LMVarId → Bool

full_name: Lean.MetavarContext.LevelMVarToParam.State.mctx
code: structure State where
  mctx         : MetavarContext
  paramNames   : Array Name := #[]
  nextParamIdx : Nat
  cache        : HashMap ExprStructEq Expr := {}
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.LevelMVarToParam.State.cache
code: structure State where
  mctx         : MetavarContext
  paramNames   : Array Name := #[]
  nextParamIdx : Nat
  cache        : HashMap ExprStructEq Expr := {}
goal: Lean.HashMap Lean.ExprStructEq Lean.Expr

full_name: Lean.MetavarContext.LevelMVarToParam.State.nextParamIdx
code: structure State where
  mctx         : MetavarContext
  paramNames   : Array Name := #[]
  nextParamIdx : Nat
  cache        : HashMap ExprStructEq Expr := {}
goal: Nat

full_name: Lean.MetavarContext.LevelMVarToParam.State.paramNames
code: structure State where
  mctx         : MetavarContext
  paramNames   : Array Name := #[]
  nextParamIdx : Nat
  cache        : HashMap ExprStructEq Expr := {}
goal: Array Lean.Name

full_name: Lean.MetavarContext.LevelMVarToParam.State
code: structure State where
  mctx         : MetavarContext
  paramNames   : Array Name := #[]
  nextParamIdx : Nat
  cache        : HashMap ExprStructEq Expr := {}
goal: Type

full_name: Lean.MetavarContext.LevelMVarToParam.M
code: abbrev M 
goal: Type

full_name: Lean.MetavarContext.LevelMVarToParam.instMonadMCtxM
code: instance : MonadMCtx M 
goal: Lean.MonadMCtx Lean.MetavarContext.LevelMVarToParam.M

full_name: Lean.MetavarContext.LevelMVarToParam.instMonadCacheExprStructEqExprM
code: instance : MonadCache ExprStructEq Expr M 
goal: Lean.MonadCache Lean.ExprStructEq Lean.Expr Lean.MetavarContext.LevelMVarToParam.M

full_name: Lean.MetavarContext.LevelMVarToParam.mkParamName
code: partial def mkParamName : M Name 
goal: Lean.MetavarContext.LevelMVarToParam.M Lean.Name

full_name: Lean.MetavarContext.LevelMVarToParam.visitLevel
code: partial def visitLevel (u : Level) : M Level 
goal: Lean.MetavarContext.LevelMVarToParam.M Lean.Level

full_name: Lean.MetavarContext.LevelMVarToParam.main
code: partial def main (e : Expr) : M Expr 
goal: Lean.MetavarContext.LevelMVarToParam.M Lean.Expr

full_name: Lean.MetavarContext.LevelMVarToParam.main.visitApp
code: partial def main (e : Expr) : M Expr 
goal: Lean.MetavarContext.LevelMVarToParam.M Lean.Expr

full_name: Lean.MetavarContext.UnivMVarParamResult.newParamNames
code: structure UnivMVarParamResult where
  mctx          : MetavarContext
  newParamNames : Array Name
  nextParamIdx  : Nat
  expr          : Expr
goal: Array Lean.Name

full_name: Lean.MetavarContext.UnivMVarParamResult
code: structure UnivMVarParamResult where
  mctx          : MetavarContext
  newParamNames : Array Name
  nextParamIdx  : Nat
  expr          : Expr
goal: Type

full_name: Lean.MetavarContext.UnivMVarParamResult.mctx
code: structure UnivMVarParamResult where
  mctx          : MetavarContext
  newParamNames : Array Name
  nextParamIdx  : Nat
  expr          : Expr
goal: Lean.MetavarContext

full_name: Lean.MetavarContext.UnivMVarParamResult.nextParamIdx
code: structure UnivMVarParamResult where
  mctx          : MetavarContext
  newParamNames : Array Name
  nextParamIdx  : Nat
  expr          : Expr
goal: Nat

full_name: Lean.MetavarContext.UnivMVarParamResult.expr
code: structure UnivMVarParamResult where
  mctx          : MetavarContext
  newParamNames : Array Name
  nextParamIdx  : Nat
  expr          : Expr
goal: Lean.Expr

full_name: Lean.MetavarContext.levelMVarToParam
code: def levelMVarToParam (mctx : MetavarContext) (alreadyUsedPred : Name → Bool) (except : LMVarId → Bool) (e : Expr) (paramNamePrefix : Name := `u) (nextParamIdx : Nat := 1)
    : UnivMVarParamResult 
goal: Lean.MetavarContext.UnivMVarParamResult

full_name: Lean.MetavarContext.getExprAssignmentDomain
code: def getExprAssignmentDomain (mctx : MetavarContext) : Array MVarId 
goal: Array Lean.MVarId

full_name: Lean.MVarId.modifyDecl
code: /--
Modify the declaration of a metavariable. If the metavariable is not declared,
nothing happens.

You must ensure that the modification is legal. In particular, expressions may
only be replaced with defeq expressions.
-/
def modifyDecl [MonadMCtx m] (mvarId : MVarId)
    (f : MetavarDecl → MetavarDecl) : m Unit 
goal: m Unit

full_name: Lean.MVarId.modifyLCtx
code: /--
Modify the local context of a metavariable. If the metavariable is not declared,
nothing happens.

You must ensure that the modification is legal. In particular, expressions may
only be replaced with defeq expressions.
-/
def modifyLCtx [MonadMCtx m] (mvarId : MVarId)
    (f : LocalContext → LocalContext) : m Unit 
goal: m Unit

full_name: Lean.MVarId.setFVarKind
code: /--
Set the kind of an fvar. If the given metavariable is not declared or the
given fvar doesn't exist in its context, nothing happens.
-/
def setFVarKind [MonadMCtx m] (mvarId : MVarId) (fvarId : FVarId)
    (kind : LocalDeclKind) : m Unit 
goal: m Unit

full_name: Lean.MVarId.setFVarBinderInfo
code: /--
Set the `BinderInfo` of an fvar. If the given metavariable is not declared or
the given fvar doesn't exist in its context, nothing happens.
-/
def setFVarBinderInfo [MonadMCtx m] (mvarId : MVarId) (fvarId : FVarId)
    (bi : BinderInfo) : m Unit 
goal: m Unit