File: .lake/packages/lean4/src/lean/Lean/Meta/Tactic/ElimInfo.lean

full_name: Lean.Meta.ElimAltInfo.declName?
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Option Lean.Name

full_name: Lean.Meta.ElimAltInfo.provesMotive
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Bool

full_name: Lean.Meta.ElimAltInfo.name
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Lean.Name

full_name: Lean.Meta.ElimAltInfo.numFields
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Nat

full_name: Lean.Meta.ElimAltInfo
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Type

full_name: Lean.Meta.instInhabitedElimAltInfo
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Inhabited Lean.Meta.ElimAltInfo

full_name: Lean.Meta.instReprElimAltInfo
code: structure ElimAltInfo where
  name      : Name
  /-- A declaration corresponding to the inductive constructor.
  (For custom recursors, the alternatives correspond to parameter names in the
  recursor, so we may not have a declaration to point to.)
  This is used for go-to-definition on the alternative name. -/
  declName? : Option Name
  numFields : Nat
  /-- If `provesMotive := true`, then this alternative has `motive` as its conclusion.
  Only for those alternatives the `induction` tactic should introduce reverted hypotheses.  -/
  provesMotive : Bool
  deriving Repr, Inhabited
goal: Repr Lean.Meta.ElimAltInfo

full_name: Lean.Meta.ElimInfo.elimType
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Lean.Expr

full_name: Lean.Meta.ElimInfo.motivePos
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Nat

full_name: Lean.Meta.instInhabitedElimInfo
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Inhabited Lean.Meta.ElimInfo

full_name: Lean.Meta.ElimInfo.targetsPos
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Array Nat

full_name: Lean.Meta.ElimInfo
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Type

full_name: Lean.Meta.ElimInfo.altsInfo
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Array Lean.Meta.ElimAltInfo

full_name: Lean.Meta.instReprElimInfo
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Repr Lean.Meta.ElimInfo

full_name: Lean.Meta.ElimInfo.elimExpr
code: /--
Information about an eliminator as used by `induction` or `cases`.

Created from an expression by `getElimInfo`. This typically contains level metavariables that
are instantiated as we go (e.g. in `addImplicitTargets`), so this is single use.
-/
structure ElimInfo where
  elimExpr   : Expr
  elimType   : Expr
  motivePos  : Nat
  targetsPos : Array Nat := #[]
  altsInfo   : Array ElimAltInfo := #[]
  deriving Repr, Inhabited
goal: Lean.Expr

full_name: Lean.Meta.altArity
code: /-- Given the type `t` of an alternative, determines the number of parameters
(.forall and .let)-bound, and whether the conclusion is a `motive`-application.  -/
def altArity (motive : Expr) (n : Nat) : Expr → Nat × Bool
  
goal: Lean.Expr → Nat × Bool

full_name: Lean.Meta.getElimExprInfo
code: def getElimExprInfo (elimExpr : Expr) (baseDeclName? : Option Name := none) : MetaM ElimInfo 
goal: Lean.MetaM Lean.Meta.ElimInfo

full_name: Lean.Meta.getElimInfo
code: def getElimInfo (elimName : Name) (baseDeclName? : Option Name := none) : MetaM ElimInfo 
goal: Lean.MetaM Lean.Meta.ElimInfo

full_name: Lean.Meta.addImplicitTargets
code: /--
  Eliminators/recursors may have implicit targets. For builtin recursors, all indices are implicit targets.
  Given an eliminator and the sequence of explicit targets, this methods returns a new sequence containing
  implicit and explicit targets.
-/
partial def addImplicitTargets (elimInfo : ElimInfo) (targets : Array Expr) : MetaM (Array Expr) 
goal: Lean.MetaM (Array Lean.Expr)

full_name: Lean.Meta.addImplicitTargets.collect
code: /--
  Eliminators/recursors may have implicit targets. For builtin recursors, all indices are implicit targets.
  Given an eliminator and the sequence of explicit targets, this methods returns a new sequence containing
  implicit and explicit targets.
-/
partial def addImplicitTargets (elimInfo : ElimInfo) (targets : Array Expr) : MetaM (Array Expr) 
goal: Lean.MetaM (Array Lean.MVarId × Array Lean.Expr)

full_name: Lean.Meta.CustomEliminator.elimName
code: structure CustomEliminator where
  induction : Bool
  typeNames : Array Name
  elimName  : Name -- NB: Do not store the ElimInfo, it can contain MVars
  deriving Inhabited, Repr
goal: Lean.Name

full_name: Lean.Meta.CustomEliminator.typeNames
code: structure CustomEliminator where
  induction : Bool
  typeNames : Array Name
  elimName  : Name -- NB: Do not store the ElimInfo, it can contain MVars
  deriving Inhabited, Repr
goal: Array Lean.Name

full_name: Lean.Meta.CustomEliminator.induction
code: structure CustomEliminator where
  induction : Bool
  typeNames : Array Name
  elimName  : Name -- NB: Do not store the ElimInfo, it can contain MVars
  deriving Inhabited, Repr
goal: Bool

full_name: Lean.Meta.CustomEliminator
code: structure CustomEliminator where
  induction : Bool
  typeNames : Array Name
  elimName  : Name -- NB: Do not store the ElimInfo, it can contain MVars
  deriving Inhabited, Repr
goal: Type

full_name: Lean.Meta.instInhabitedCustomEliminator
code: structure CustomEliminator where
  induction : Bool
  typeNames : Array Name
  elimName  : Name -- NB: Do not store the ElimInfo, it can contain MVars
  deriving Inhabited, Repr
goal: Inhabited Lean.Meta.CustomEliminator

full_name: Lean.Meta.instReprCustomEliminator
code: structure CustomEliminator where
  induction : Bool
  typeNames : Array Name
  elimName  : Name -- NB: Do not store the ElimInfo, it can contain MVars
  deriving Inhabited, Repr
goal: Repr Lean.Meta.CustomEliminator

full_name: Lean.Meta.instInhabitedCustomEliminators
code: structure CustomEliminators where
  map : SMap (Bool × Array Name) Name := {}
  deriving Inhabited, Repr
goal: Inhabited Lean.Meta.CustomEliminators

full_name: Lean.Meta.instReprCustomEliminators
code: structure CustomEliminators where
  map : SMap (Bool × Array Name) Name := {}
  deriving Inhabited, Repr
goal: Repr Lean.Meta.CustomEliminators

full_name: Lean.Meta.CustomEliminators
code: structure CustomEliminators where
  map : SMap (Bool × Array Name) Name := {}
  deriving Inhabited, Repr
goal: Type

full_name: Lean.Meta.CustomEliminators.map
code: structure CustomEliminators where
  map : SMap (Bool × Array Name) Name := {}
  deriving Inhabited, Repr
goal: Lean.SMap (Bool × Array Lean.Name) Lean.Name

full_name: Lean.Meta.addCustomEliminatorEntry
code: def addCustomEliminatorEntry (es : CustomEliminators) (e : CustomEliminator) : CustomEliminators 
goal: Lean.Meta.CustomEliminators

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.Tactic.ElimInfo._hyg.2352
code: builtin_initialize customEliminatorExt : SimpleScopedEnvExtension CustomEliminator CustomEliminators ←
  registerSimpleScopedEnvExtension {
    initial        := {}
    addEntry       := addCustomEliminatorEntry
    finalizeImport := fun { map := map } => { map := map.switch }
  }
goal: IO (Lean.SimpleScopedEnvExtension Lean.Meta.CustomEliminator Lean.Meta.CustomEliminators)

full_name: Lean.Meta.customEliminatorExt
code: builtin_initialize customEliminatorExt : SimpleScopedEnvExtension CustomEliminator CustomEliminators ←
  registerSimpleScopedEnvExtension {
    initial        := {}
    addEntry       := addCustomEliminatorEntry
    finalizeImport := fun { map := map } => { map := map.switch }
  }
goal: Lean.SimpleScopedEnvExtension Lean.Meta.CustomEliminator Lean.Meta.CustomEliminators

full_name: Lean.Meta.mkCustomEliminator
code: def mkCustomEliminator (elimName : Name) (induction : Bool) : MetaM CustomEliminator 
goal: Lean.MetaM Lean.Meta.CustomEliminator

full_name: Lean.Meta.addCustomEliminator
code: def addCustomEliminator (declName : Name) (attrKind : AttributeKind) (induction : Bool) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.Tactic.ElimInfo._hyg.3012
code: builtin_initialize
  registerBuiltinAttribute {
    name  := `induction_eliminator
    descr := "custom `rec`-like eliminator for the `induction` tactic"
    add   := fun declName _ attrKind => do
      discard <| addCustomEliminator declName attrKind (induction := true) |>.run {} {}
  }
goal: IO Unit

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.Tactic.ElimInfo._hyg.3102
code: builtin_initialize
  registerBuiltinAttribute {
    name  := `cases_eliminator
    descr := "custom `casesOn`-like eliminator for the `cases` tactic"
    add   := fun declName _ attrKind => do
      discard <| addCustomEliminator declName attrKind (induction := false) |>.run {} {}
  }
goal: IO Unit

full_name: Lean.Meta.getCustomEliminators
code: /-- Gets all the eliminators defined using the `@[induction_eliminator]` and `@[cases_eliminator]` attributes. -/
def getCustomEliminators : CoreM CustomEliminators 
goal: Lean.CoreM Lean.Meta.CustomEliminators

full_name: Lean.Meta.getCustomEliminator?
code: /--
Gets an eliminator appropriate for the provided array of targets.
If `induction` is `true` then returns a matching eliminator defined using the `@[induction_eliminator]` attribute
and otherwise returns one defined using the `@[cases_eliminator]` attribute.

The `@[induction_eliminator]` attribute is for the `induction` tactic
and the `@[cases_eliminator]` attribute is for the `cases` tactic.
-/
def getCustomEliminator? (targets : Array Expr) (induction : Bool) : MetaM (Option Name) 
goal: Lean.MetaM (Option Lean.Name)