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

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.throwInductiveTypeExpected
code: private def throwInductiveTypeExpected (type : Expr) : MetaM α 
goal: Lean.MetaM α

full_name: Lean.Meta.getInductiveUniverseAndParams
code: def getInductiveUniverseAndParams (type : Expr) : MetaM (List Level × Array Expr) 
goal: Lean.MetaM (List Lean.Level × Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.mkEqAndProof
code: private def mkEqAndProof (lhs rhs : Expr) : MetaM (Expr × Expr) 
goal: Lean.MetaM (Lean.Expr × Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.withNewEqs
code: private partial def withNewEqs (targets targetsNew : Array Expr) (k : Array Expr → Array Expr → MetaM α) : MetaM α 
goal: Lean.MetaM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.withNewEqs.loop
code: private partial def withNewEqs (targets targetsNew : Array Expr) (k : Array Expr → Array Expr → MetaM α) : MetaM α 
goal: Lean.MetaM α

full_name: Lean.Meta.generalizeTargetsEq
code: def generalizeTargetsEq (mvarId : MVarId) (motiveType : Expr) (targets : Array Expr) : MetaM MVarId 
goal: Lean.MetaM Lean.MVarId

full_name: Lean.Meta.GeneralizeIndicesSubgoal.numEqs
code: structure GeneralizeIndicesSubgoal where
  mvarId         : MVarId
  indicesFVarIds : Array FVarId
  fvarId         : FVarId
  numEqs         : Nat
goal: Nat

full_name: Lean.Meta.GeneralizeIndicesSubgoal.fvarId
code: structure GeneralizeIndicesSubgoal where
  mvarId         : MVarId
  indicesFVarIds : Array FVarId
  fvarId         : FVarId
  numEqs         : Nat
goal: Lean.FVarId

full_name: Lean.Meta.GeneralizeIndicesSubgoal.mvarId
code: structure GeneralizeIndicesSubgoal where
  mvarId         : MVarId
  indicesFVarIds : Array FVarId
  fvarId         : FVarId
  numEqs         : Nat
goal: Lean.MVarId

full_name: Lean.Meta.GeneralizeIndicesSubgoal
code: structure GeneralizeIndicesSubgoal where
  mvarId         : MVarId
  indicesFVarIds : Array FVarId
  fvarId         : FVarId
  numEqs         : Nat
goal: Type

full_name: Lean.Meta.GeneralizeIndicesSubgoal.indicesFVarIds
code: structure GeneralizeIndicesSubgoal where
  mvarId         : MVarId
  indicesFVarIds : Array FVarId
  fvarId         : FVarId
  numEqs         : Nat
goal: Array Lean.FVarId

full_name: Lean.Meta.generalizeIndices
code: /--
  Similar to `generalizeTargets` but customized for the `casesOn` motive.
  Given a metavariable `mvarId` representing the
  ```
  Ctx, h : I A j, D |- T
  ```
  where `fvarId` is `h`s id, and the type `I A j` is an inductive datatype where `A` are parameters,
  and `j` the indices. Generate the goal
  ```
  Ctx, h : I A j, D, j' : J, h' : I A j' |- j == j' -> h == h' -> T
  ```
  Remark: `(j == j' -> h == h')` is a "telescopic" equality.
  Remark: `j` is sequence of terms, and `j'` a sequence of free variables.
  The result contains the fields
  - `mvarId`: the new goal
  - `indicesFVarIds`: `j'` ids
  - `fvarId`: `h'` id
  - `numEqs`: number of equations in the target -/
def generalizeIndices (mvarId : MVarId) (fvarId : FVarId) : MetaM GeneralizeIndicesSubgoal 
goal: Lean.MetaM Lean.Meta.GeneralizeIndicesSubgoal

full_name: Lean.Meta.CasesSubgoal
code: structure CasesSubgoal extends InductionSubgoal where
  ctorName : Name
goal: Type

full_name: Lean.Meta.CasesSubgoal.ctorName
code: structure CasesSubgoal extends InductionSubgoal where
  ctorName : Name
goal: Lean.Name

full_name: Lean.Meta.Cases.Context.casesOnVal
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Lean.DefinitionVal

full_name: Lean.Meta.Cases.Context
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Type

full_name: Lean.Meta.Cases.Context.majorTypeFn
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Lean.Expr

full_name: Lean.Meta.Cases.Context.majorTypeIndices
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Array Lean.Expr

full_name: Lean.Meta.Cases.Context.nminors
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Nat

full_name: Lean.Meta.Cases.Context.majorTypeArgs
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Array Lean.Expr

full_name: Lean.Meta.Cases.Context.inductiveVal
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Lean.InductiveVal

full_name: Lean.Meta.Cases.Context.majorDecl
code: structure Context where
  inductiveVal     : InductiveVal
  casesOnVal       : DefinitionVal
  nminors          : Nat := inductiveVal.ctors.length
  majorDecl        : LocalDecl
  majorTypeFn      : Expr
  majorTypeArgs    : Array Expr
  majorTypeIndices : Array Expr := majorTypeArgs.extract (majorTypeArgs.size - inductiveVal.numIndices) majorTypeArgs.size
goal: Lean.LocalDecl

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.Cases.mkCasesContext?
code: private def mkCasesContext? (majorFVarId : FVarId) : MetaM (Option Context) 
goal: Lean.MetaM (Option Lean.Meta.Cases.Context)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.Cases.hasIndepIndices
code: /--
We say the major premise has independent indices IF
1- its type is *not* an indexed inductive family, OR
2- its type is an indexed inductive family, but all indices are distinct free variables, and
   all local declarations different from the major and its indices do not depend on the indices.
-/
private def hasIndepIndices (ctx : Context) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.Cases.elimAuxIndices
code: private def elimAuxIndices (s₁ : GeneralizeIndicesSubgoal) (s₂ : Array CasesSubgoal) : MetaM (Array CasesSubgoal) 
goal: Lean.MetaM (Array Lean.Meta.CasesSubgoal)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.Cases.toCasesSubgoals
code: /--
  Convert `s` into an array of `CasesSubgoal`, by attaching the corresponding constructor name,
  and adding the substitution `majorFVarId -> ctor_i us params fields` into each subgoal. -/
private def toCasesSubgoals (s : Array InductionSubgoal) (ctorNames : Array Name) (majorFVarId : FVarId) (us : List Level) (params : Array Expr)
    : Array CasesSubgoal 
goal: Array Lean.Meta.CasesSubgoal

full_name: Lean.Meta.Cases.unifyEqs?
code: partial def unifyEqs? (numEqs : Nat) (mvarId : MVarId) (subst : FVarSubst) (caseName? : Option Name := none): MetaM (Option (MVarId × FVarSubst)) 
goal: Lean.MetaM (Option (Lean.MVarId × Lean.Meta.FVarSubst))

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.Cases.unifyCasesEqs
code: private def unifyCasesEqs (numEqs : Nat) (subgoals : Array CasesSubgoal) : MetaM (Array CasesSubgoal) 
goal: Lean.MetaM (Array Lean.Meta.CasesSubgoal)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.Cases.inductionCasesOn
code: private def inductionCasesOn (mvarId : MVarId) (majorFVarId : FVarId) (givenNames : Array AltVarNames) (ctx : Context)
    (useNatCasesAuxOn : Bool := false) : MetaM (Array CasesSubgoal) 
goal: Lean.MetaM (Array Lean.Meta.CasesSubgoal)

full_name: Lean.Meta.Cases.cases
code: def cases (mvarId : MVarId) (majorFVarId : FVarId) (givenNames : Array AltVarNames := #[]) (useNatCasesAuxOn : Bool := false) : MetaM (Array CasesSubgoal) 
goal: Lean.MetaM (Array Lean.Meta.CasesSubgoal)

full_name: Lean.MVarId.cases
code: /--
Apply `casesOn` using the free variable `majorFVarId` as the major premise (aka discriminant).
`givenNames` contains user-facing names for each alternative.

- `useNatCasesAuxOn` is a temporary hack for the `rcases` family of tactics.
  Do not use it, as it is subject to removal.
  It enables using `Nat.casesAuxOn` instead of `Nat.casesOn`,
  which causes case splits on `n : Nat` to be represented as `0` and `n' + 1` rather than as `Nat.zero` and `Nat.succ n'`.
-/
def _root_.Lean.MVarId.cases (mvarId : MVarId) (majorFVarId : FVarId) (givenNames : Array AltVarNames := #[]) (useNatCasesAuxOn : Bool := false) : MetaM (Array CasesSubgoal) 
goal: Lean.MetaM (Array Lean.Meta.CasesSubgoal)

full_name: Lean.Meta.cases
code: @[deprecated MVarId.cases (since := "2022-07-15")]
def cases (mvarId : MVarId) (majorFVarId : FVarId) (givenNames : Array AltVarNames := #[]) : MetaM (Array CasesSubgoal) 
goal: Lean.MetaM (Array Lean.Meta.CasesSubgoal)

full_name: Lean.MVarId.casesRec
code: /--
Keep applying `cases` on any hypothesis that satisfies `p`.
-/
def _root_.Lean.MVarId.casesRec (mvarId : MVarId) (p : LocalDecl → MetaM Bool) : MetaM (List MVarId) 
goal: Lean.MetaM (List Lean.MVarId)

full_name: Lean.MVarId.casesAnd
code: /--
Applies `cases` (recursively) to any hypothesis of the form `h : p ∧ q`.
-/
def _root_.Lean.MVarId.casesAnd (mvarId : MVarId) : MetaM MVarId 
goal: Lean.MetaM Lean.MVarId

full_name: Lean.MVarId.substEqs
code: /--
Applies `cases` to any hypothesis of the form `h : r = s`.
-/
def _root_.Lean.MVarId.substEqs (mvarId : MVarId) : MetaM (Option MVarId) 
goal: Lean.MetaM (Option Lean.MVarId)

full_name: Lean.Meta.ByCasesSubgoal.mvarId
code: /-- Auxiliary structure for storing `byCases` tactic result. -/
structure ByCasesSubgoal where
  mvarId : MVarId
  fvarId : FVarId
goal: Lean.MVarId

full_name: Lean.Meta.ByCasesSubgoal.fvarId
code: /-- Auxiliary structure for storing `byCases` tactic result. -/
structure ByCasesSubgoal where
  mvarId : MVarId
  fvarId : FVarId
goal: Lean.FVarId

full_name: Lean.Meta.ByCasesSubgoal
code: /-- Auxiliary structure for storing `byCases` tactic result. -/
structure ByCasesSubgoal where
  mvarId : MVarId
  fvarId : FVarId
goal: Type

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.Tactic.Cases.0.Lean.Meta.toByCasesSubgoal
code: private def toByCasesSubgoal (s : CasesSubgoal) : MetaM ByCasesSubgoal 
goal: Lean.MetaM Lean.Meta.ByCasesSubgoal

full_name: Lean.MVarId.byCases
code: /--
Split the goal in two subgoals: one containing the hypothesis `h : p` and another containing `h : ¬ p`.
-/
def _root_.Lean.MVarId.byCases (mvarId : MVarId) (p : Expr) (hName : Name := `h) : MetaM (ByCasesSubgoal × ByCasesSubgoal) 
goal: Lean.MetaM (Lean.Meta.ByCasesSubgoal × Lean.Meta.ByCasesSubgoal)

full_name: Lean.MVarId.byCasesDec
code: /--
Given `dec : Decidable p`, split the goal in two subgoals: one containing the hypothesis `h : p` and another containing `h : ¬ p`.
-/
def _root_.Lean.MVarId.byCasesDec (mvarId : MVarId) (p : Expr) (dec : Expr) (hName : Name := `h) : MetaM (ByCasesSubgoal × ByCasesSubgoal) 
goal: Lean.MetaM (Lean.Meta.ByCasesSubgoal × Lean.Meta.ByCasesSubgoal)

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.Tactic.Cases._hyg.3729
code: builtin_initialize registerTraceClass `Meta.Tactic.cases
goal: IO Unit