File: .lake/packages/lean4/src/lean/Lean/Elab/Inductive.lean

full_name: Lean.Elab.Command.initFn._@..lake.packages.lean4.src.lean.Lean.Elab.Inductive._hyg.5
code: builtin_initialize
  registerTraceClass `Elab.inductive
goal: IO Unit

full_name: Lean.Elab.Command.initFn._@..lake.packages.lean4.src.lean.Lean.Elab.Inductive._hyg.58
code: register_builtin_option inductive.autoPromoteIndices : Bool := {
    defValue := true
    descr    := "Promote indices to parameters in inductive types whenever possible."
  }
goal: IO (Lean.Option Bool)

full_name: Lean.Elab.Command.inductive.autoPromoteIndices
code: register_builtin_option inductive.autoPromoteIndices : Bool := {
    defValue := true
    descr    := "Promote indices to parameters in inductive types whenever possible."
  }
goal: Lean.Option Bool

full_name: Lean.Elab.Command.checkValidInductiveModifier
code: def checkValidInductiveModifier [Monad m] [MonadError m] (modifiers : Modifiers) : m Unit 
goal: m Unit

full_name: Lean.Elab.Command.checkValidCtorModifier
code: def checkValidCtorModifier [Monad m] [MonadError m] (modifiers : Modifiers) : m Unit 
goal: m Unit

full_name: Lean.Elab.Command.CtorView.binders
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Command.CtorView.declName
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Lean.Name

full_name: Lean.Elab.Command.CtorView.type?
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Option Lean.Syntax

full_name: Lean.Elab.Command.CtorView.modifiers
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Lean.Elab.Modifiers

full_name: Lean.Elab.Command.CtorView
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Command.instInhabitedCtorView
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Inhabited Lean.Elab.Command.CtorView

full_name: Lean.Elab.Command.CtorView.ref
code: structure CtorView where
  ref       : Syntax
  modifiers : Modifiers
  declName  : Name
  binders   : Syntax
  type?     : Option Syntax
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Command.ComputedFieldView.type
code: structure ComputedFieldView where
  ref       : Syntax
  modifiers : Syntax
  fieldId   : Name
  type      : Syntax.Term
  matchAlts : TSyntax ``Parser.Term.matchAlts
goal: Lean.Term

full_name: Lean.Elab.Command.ComputedFieldView.matchAlts
code: structure ComputedFieldView where
  ref       : Syntax
  modifiers : Syntax
  fieldId   : Name
  type      : Syntax.Term
  matchAlts : TSyntax ``Parser.Term.matchAlts
goal: Lean.TSyntax `Lean.Parser.Term.matchAlts

full_name: Lean.Elab.Command.ComputedFieldView.modifiers
code: structure ComputedFieldView where
  ref       : Syntax
  modifiers : Syntax
  fieldId   : Name
  type      : Syntax.Term
  matchAlts : TSyntax ``Parser.Term.matchAlts
goal: Lean.Syntax

full_name: Lean.Elab.Command.ComputedFieldView
code: structure ComputedFieldView where
  ref       : Syntax
  modifiers : Syntax
  fieldId   : Name
  type      : Syntax.Term
  matchAlts : TSyntax ``Parser.Term.matchAlts
goal: Type

full_name: Lean.Elab.Command.ComputedFieldView.fieldId
code: structure ComputedFieldView where
  ref       : Syntax
  modifiers : Syntax
  fieldId   : Name
  type      : Syntax.Term
  matchAlts : TSyntax ``Parser.Term.matchAlts
goal: Lean.Name

full_name: Lean.Elab.Command.ComputedFieldView.ref
code: structure ComputedFieldView where
  ref       : Syntax
  modifiers : Syntax
  fieldId   : Name
  type      : Syntax.Term
  matchAlts : TSyntax ``Parser.Term.matchAlts
goal: Lean.Syntax

full_name: Lean.Elab.Command.InductiveView.ref
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Command.instInhabitedInductiveView
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Inhabited Lean.Elab.Command.InductiveView

full_name: Lean.Elab.Command.InductiveView.derivingClasses
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Array Lean.Elab.DerivingClassView

full_name: Lean.Elab.Command.InductiveView.shortDeclName
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Lean.Name

full_name: Lean.Elab.Command.InductiveView.computedFields
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Array Lean.Elab.Command.ComputedFieldView

full_name: Lean.Elab.Command.InductiveView.type?
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Option Lean.Syntax

full_name: Lean.Elab.Command.InductiveView.binders
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Command.InductiveView.levelNames
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: List Lean.Name

full_name: Lean.Elab.Command.InductiveView.ctors
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Array Lean.Elab.Command.CtorView

full_name: Lean.Elab.Command.InductiveView.declName
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Lean.Name

full_name: Lean.Elab.Command.InductiveView.declId
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.Command.InductiveView
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Command.InductiveView.modifiers
code: structure InductiveView where
  ref             : Syntax
  declId          : Syntax
  modifiers       : Modifiers
  shortDeclName   : Name
  declName        : Name
  levelNames      : List Name
  binders         : Syntax
  type?           : Option Syntax
  ctors           : Array CtorView
  derivingClasses : Array DerivingClassView
  computedFields  : Array ComputedFieldView
  deriving Inhabited
goal: Lean.Elab.Modifiers

full_name: Lean.Elab.Command.ElabHeaderResult.lctx
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Lean.LocalContext

full_name: Lean.Elab.Command.ElabHeaderResult.params
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Elab.Command.ElabHeaderResult
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Type

full_name: Lean.Elab.Command.ElabHeaderResult.type
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Lean.Expr

full_name: Lean.Elab.Command.instInhabitedElabHeaderResult
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Inhabited Lean.Elab.Command.ElabHeaderResult

full_name: Lean.Elab.Command.ElabHeaderResult.localInsts
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Lean.LocalInstances

full_name: Lean.Elab.Command.ElabHeaderResult.view
code: structure ElabHeaderResult where
  view       : InductiveView
  lctx       : LocalContext
  localInsts : LocalInstances
  params     : Array Expr
  type       : Expr
  deriving Inhabited
goal: Lean.Elab.Command.InductiveView

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.elabHeaderAux
code: private partial def elabHeaderAux (views : Array InductiveView) (i : Nat) (acc : Array ElabHeaderResult) : TermElabM (Array ElabHeaderResult) 
goal: Lean.Elab.TermElabM (Array Lean.Elab.Command.ElabHeaderResult)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkNumParams
code: private def checkNumParams (rs : Array ElabHeaderResult) : TermElabM Nat 
goal: Lean.Elab.TermElabM Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkUnsafe
code: private def checkUnsafe (rs : Array ElabHeaderResult) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkLevelNames
code: private def checkLevelNames (views : Array InductiveView) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.mkTypeFor
code: private def mkTypeFor (r : ElabHeaderResult) : TermElabM Expr 
goal: Lean.Elab.TermElabM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.throwUnexpectedInductiveType
code: private def throwUnexpectedInductiveType : TermElabM α 
goal: Lean.Elab.TermElabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.eqvFirstTypeResult
code: private def eqvFirstTypeResult (firstType type : Expr) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkParamsAndResultType
code: private partial def checkParamsAndResultType (type firstType : Expr) (numParams : Nat) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkHeader
code: private def checkHeader (r : ElabHeaderResult) (numParams : Nat) (firstType? : Option Expr) : TermElabM Expr 
goal: Lean.Elab.TermElabM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkHeaders
code: private partial def checkHeaders (rs : Array ElabHeaderResult) (numParams : Nat) (i : Nat) (firstType? : Option Expr) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.elabHeader
code: private def elabHeader (views : Array InductiveView) : TermElabM (Array ElabHeaderResult) 
goal: Lean.Elab.TermElabM (Array Lean.Elab.Command.ElabHeaderResult)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.withInductiveLocalDecls
code: /-- Create a local declaration for each inductive type in `rs`, and execute `x params indFVars`, where `params` are the inductive type parameters and
   `indFVars` are the new local declarations.
   We use the local context/instances and parameters of rs[0].
   Note that this method is executed after we executed `checkHeaders` and established all
   parameters are compatible. -/
private partial def withInductiveLocalDecls (rs : Array ElabHeaderResult) (x : Array Expr → Array Expr → TermElabM α) : TermElabM α 
goal: Lean.Elab.TermElabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.withInductiveLocalDecls.loop
code: /-- Create a local declaration for each inductive type in `rs`, and execute `x params indFVars`, where `params` are the inductive type parameters and
   `indFVars` are the new local declarations.
   We use the local context/instances and parameters of rs[0].
   Note that this method is executed after we executed `checkHeaders` and established all
   parameters are compatible. -/
private partial def withInductiveLocalDecls (rs : Array ElabHeaderResult) (x : Array Expr → Array Expr → TermElabM α) : TermElabM α 
goal: Lean.Elab.TermElabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.isInductiveFamily
code: private def isInductiveFamily (numParams : Nat) (indFVar : Expr) : TermElabM Bool 
goal: Lean.Elab.TermElabM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.getArrowBinderNames.go
code: private def getArrowBinderNames (type : Expr) : Array Name 
goal: Array Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.getArrowBinderNames
code: private def getArrowBinderNames (type : Expr) : Array Name 
goal: Array Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.replaceArrowBinderNames.go
code: /--
  Replace binder names in `type` with `newNames`.
  Remark: we only replace the names for binder containing macroscopes.
-/
private def replaceArrowBinderNames (type : Expr) (newNames : Array Name) : Expr 
goal: Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.replaceArrowBinderNames
code: /--
  Replace binder names in `type` with `newNames`.
  Remark: we only replace the names for binder containing macroscopes.
-/
private def replaceArrowBinderNames (type : Expr) (newNames : Array Name) : Expr 
goal: Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.reorderCtorArgs
code: /--
  Reorder constructor arguments to improve the effectiveness of the `fixedIndicesToParams` method.

  The idea is quite simple. Given a constructor type of the form
  ```
  (a₁ : A₁) → ... → (aₙ : Aₙ) → C b₁ ... bₘ
  ```
  We try to find the longest prefix `b₁ ... bᵢ`, `i ≤ m` s.t.
  - each `bₖ` is in `{a₁, ..., aₙ}`
  - each `bₖ` only depends on variables in `{b₁, ..., bₖ₋₁}`

  Then, it moves this prefix `b₁ ... bᵢ` to the front.

  Remark: We only reorder implicit arguments that have macroscopes. See issue #1156.
  The macroscope test is an approximation, we could have restricted ourselves to auto-implicit arguments.
-/
private def reorderCtorArgs (ctorType : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.withExplicitToImplicit
code: /--
  Execute `k` with updated binder information for `xs`. Any `x` that is explicit becomes implicit.
-/
private def withExplicitToImplicit (xs : Array Expr) (k : TermElabM α) : TermElabM α 
goal: Lean.Elab.TermElabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.elabCtors.elabCtorType
code: /--
  Elaborate constructor types.

  Remark: we check whether the resulting type is correct, and the parameter occurrences are consistent, but
  we currently do not check for:
  - Positivity (it is a rare failure, and the kernel already checks for it).
  - Universe constraints (the kernel checks for it).
-/
private def elabCtors (indFVars : Array Expr) (indFVar : Expr) (params : Array Expr) (r : ElabHeaderResult) : TermElabM (List Constructor) 
goal: Lean.Elab.TermElabM Lean.Constructor

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.elabCtors.checkParamOccs
code: /--
  Elaborate constructor types.

  Remark: we check whether the resulting type is correct, and the parameter occurrences are consistent, but
  we currently do not check for:
  - Positivity (it is a rare failure, and the kernel already checks for it).
  - Universe constraints (the kernel checks for it).
-/
private def elabCtors (indFVars : Array Expr) (indFVar : Expr) (params : Array Expr) (r : ElabHeaderResult) : TermElabM (List Constructor) 
goal: Lean.MetaM Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.elabCtors
code: /--
  Elaborate constructor types.

  Remark: we check whether the resulting type is correct, and the parameter occurrences are consistent, but
  we currently do not check for:
  - Positivity (it is a rare failure, and the kernel already checks for it).
  - Universe constraints (the kernel checks for it).
-/
private def elabCtors (indFVars : Array Expr) (indFVar : Expr) (params : Array Expr) (r : ElabHeaderResult) : TermElabM (List Constructor) 
goal: Lean.Elab.TermElabM (List Lean.Constructor)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.getResultingUniverse
code: private def getResultingUniverse : List InductiveType → TermElabM Level
  
goal: List Lean.InductiveType → Lean.Elab.TermElabM Lean.Level

full_name: Lean.Elab.Command.shouldInferResultUniverse
code: /--
  Return `some ?m` if `u` is of the form `?m + k`.
  Return none if `u` does not contain universe metavariables.
  Throw exception otherwise. -/
def shouldInferResultUniverse (u : Level) : TermElabM (Option LMVarId) 
goal: Lean.Elab.TermElabM (Option Lean.LMVarId)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.levelMVarToParam
code: /--
  Convert universe metavariables into new parameters. It skips `univToInfer?` (the inductive datatype resulting universe) because
  it should be inferred later using `inferResultingUniverse`.
-/
private def levelMVarToParam (indTypes : List InductiveType) (univToInfer? : Option LMVarId) : TermElabM (List InductiveType) 
goal: Lean.Elab.TermElabM (List Lean.InductiveType)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.levelMVarToParam.levelMVarToParam'
code: /--
  Convert universe metavariables into new parameters. It skips `univToInfer?` (the inductive datatype resulting universe) because
  it should be inferred later using `inferResultingUniverse`.
-/
private def levelMVarToParam (indTypes : List InductiveType) (univToInfer? : Option LMVarId) : TermElabM (List InductiveType) 
goal: Lean.Elab.TermElabM Lean.Expr

full_name: Lean.Elab.Command.mkResultUniverse
code: def mkResultUniverse (us : Array Level) (rOffset : Nat) : Level 
goal: Lean.Level

full_name: Lean.Elab.Command.accLevel
code: /--
   Auxiliary function for `updateResultingUniverse`
   `accLevel u r rOffset` add `u` to state if it is not already there and
   it is different from the resulting universe level `r+rOffset`.


   If `u` is a `max`, then its components are recursively processed.
   If `u` is a `succ` and `rOffset > 0`, we process the `u`s child using `rOffset-1`.

   This method is used to infer the resulting universe level of an inductive datatype.
 -/
def accLevel (u : Level) (r : Level) (rOffset : Nat) : OptionT (StateT (Array Level) Id) Unit 
goal: OptionT (StateT (Array Lean.Level) Id) Unit

full_name: Lean.Elab.Command.accLevel.go
code: /--
   Auxiliary function for `updateResultingUniverse`
   `accLevel u r rOffset` add `u` to state if it is not already there and
   it is different from the resulting universe level `r+rOffset`.


   If `u` is a `max`, then its components are recursively processed.
   If `u` is a `succ` and `rOffset > 0`, we process the `u`s child using `rOffset-1`.

   This method is used to infer the resulting universe level of an inductive datatype.
 -/
def accLevel (u : Level) (r : Level) (rOffset : Nat) : OptionT (StateT (Array Level) Id) Unit 
goal: OptionT (StateT (Array Lean.Level) Id) Unit

full_name: Lean.Elab.Command.accLevelAtCtor
code: /--
  Auxiliary function for `updateResultingUniverse`
  `accLevelAtCtor ctor ctorParam r rOffset` add `u` (`ctorParam`'s universe) to state if it is not already there and
  it is different from the resulting universe level `r+rOffset`.

  See `accLevel`.
-/
def accLevelAtCtor (ctor : Constructor) (ctorParam : Expr) (r : Level) (rOffset : Nat) : StateRefT (Array Level) TermElabM Unit 
goal: StateRefT' IO.RealWorld (Array Lean.Level) Lean.Elab.TermElabM Unit

full_name: Lean.Elab.Command.withCtorRef
code: /--
  Execute `k` using the `Syntax` reference associated with constructor `ctorName`.
-/
def withCtorRef [Monad m] [MonadRef m] (views : Array InductiveView) (ctorName : Name) (k : m α) : m α 
goal: m α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.collectUniverses.go
code: /-- Auxiliary function for `updateResultingUniverse` -/
private partial def collectUniverses (views : Array InductiveView) (r : Level) (rOffset : Nat) (numParams : Nat) (indTypes : List InductiveType) : TermElabM (Array Level) 
goal: StateRefT' IO.RealWorld (Array Lean.Level) Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.collectUniverses
code: /-- Auxiliary function for `updateResultingUniverse` -/
private partial def collectUniverses (views : Array InductiveView) (r : Level) (rOffset : Nat) (numParams : Nat) (indTypes : List InductiveType) : TermElabM (Array Level) 
goal: Lean.Elab.TermElabM (Array Lean.Level)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.updateResultingUniverse
code: private def updateResultingUniverse (views : Array InductiveView) (numParams : Nat) (indTypes : List InductiveType) : TermElabM (List InductiveType) 
goal: Lean.Elab.TermElabM (List Lean.InductiveType)

full_name: Lean.Elab.Command.initFn._@..lake.packages.lean4.src.lean.Lean.Elab.Inductive._hyg.6597
code: register_builtin_option bootstrap.inductiveCheckResultingUniverse : Bool := {
    defValue := true,
    group    := "bootstrap",
    descr    := "by default the `inductive`/`structure` commands report an error if the resulting universe is not zero, but may be zero for some universe parameters. Reason: unless this type is a subsingleton, it is hardly what the user wants since it can only eliminate into `Prop`. In the `Init` package, we define subsingletons, and we use this option to disable the check. This option may be deleted in the future after we improve the validator"
}
goal: IO (Lean.Option Bool)

full_name: Lean.Elab.Command.bootstrap.inductiveCheckResultingUniverse
code: register_builtin_option bootstrap.inductiveCheckResultingUniverse : Bool := {
    defValue := true,
    group    := "bootstrap",
    descr    := "by default the `inductive`/`structure` commands report an error if the resulting universe is not zero, but may be zero for some universe parameters. Reason: unless this type is a subsingleton, it is hardly what the user wants since it can only eliminate into `Prop`. In the `Init` package, we define subsingletons, and we use this option to disable the check. This option may be deleted in the future after we improve the validator"
}
goal: Lean.Option Bool

full_name: Lean.Elab.Command.checkResultingUniverse
code: def checkResultingUniverse (u : Level) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkResultingUniverses
code: private def checkResultingUniverses (views : Array InductiveView) (numParams : Nat) (indTypes : List InductiveType) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.checkResultingUniverses.check
code: private def checkResultingUniverses (views : Array InductiveView) (numParams : Nat) (indTypes : List InductiveType) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.collectUsed
code: private def collectUsed (indTypes : List InductiveType) : StateRefT CollectFVars.State MetaM Unit 
goal: StateRefT' IO.RealWorld Lean.CollectFVars.State Lean.MetaM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.removeUnused
code: private def removeUnused (vars : Array Expr) (indTypes : List InductiveType) : TermElabM (LocalContext × LocalInstances × Array Expr) 
goal: Lean.Elab.TermElabM (Lean.LocalContext × Lean.LocalInstances × Array Lean.Expr)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.withUsed
code: private def withUsed {α} (vars : Array Expr) (indTypes : List InductiveType) (k : Array Expr → TermElabM α) : TermElabM α 
goal: Lean.Elab.TermElabM α

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.updateParams
code: private def updateParams (vars : Array Expr) (indTypes : List InductiveType) : TermElabM (List InductiveType) 
goal: Lean.Elab.TermElabM (List Lean.InductiveType)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.collectLevelParamsInInductive
code: private def collectLevelParamsInInductive (indTypes : List InductiveType) : Array Name 
goal: Array Lean.Name

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.mkIndFVar2Const
code: private def mkIndFVar2Const (views : Array InductiveView) (indFVars : Array Expr) (levelNames : List Name) : ExprMap Expr 
goal: Lean.ExprMap Lean.Expr

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.replaceIndFVarsWithConsts
code: /-- Remark: `numVars <= numParams`. `numVars` is the number of context `variables` used in the inductive declaration,
   and `numParams` is `numVars` + number of explicit parameters provided in the declaration. -/
private def replaceIndFVarsWithConsts (views : Array InductiveView) (indFVars : Array Expr) (levelNames : List Name)
    (numVars : Nat) (numParams : Nat) (indTypes : List InductiveType) : TermElabM (List InductiveType) 
goal: Lean.Elab.TermElabM (List Lean.InductiveType)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.mkAuxConstructions
code: private def mkAuxConstructions (views : Array InductiveView) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.getArity
code: private def getArity (indType : InductiveType) : MetaM Nat 
goal: Lean.MetaM Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.resetMaskAt
code: private def resetMaskAt (mask : Array Bool) (i : Nat) : Array Bool 
goal: Array Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.computeFixedIndexBitMask.go
code: /--
  Compute a bit-mask that for `indType`. The size of the resulting array `result` is the arity of `indType`.
  The first `numParams` elements are `false` since they are parameters.
  For `i ∈ [numParams, arity)`, we have that `result[i]` if this index of the inductive family is fixed.
-/
private def computeFixedIndexBitMask (numParams : Nat) (indType : InductiveType) (indFVars : Array Expr) : MetaM (Array Bool) 
goal: Lean.MetaM (Array Bool)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.computeFixedIndexBitMask
code: /--
  Compute a bit-mask that for `indType`. The size of the resulting array `result` is the arity of `indType`.
  The first `numParams` elements are `false` since they are parameters.
  For `i ∈ [numParams, arity)`, we have that `result[i]` if this index of the inductive family is fixed.
-/
private def computeFixedIndexBitMask (numParams : Nat) (indType : InductiveType) (indFVars : Array Expr) : MetaM (Array Bool) 
goal: Lean.MetaM (Array Bool)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.isDomainDefEq
code: /-- Return true iff `arrowType` is an arrow and its domain is defeq to `type` -/
private def isDomainDefEq (arrowType : Expr) (type : Expr) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.fixedIndicesToParams
code: /--
  Convert fixed indices to parameters.
-/
private partial def fixedIndicesToParams (numParams : Nat) (indTypes : Array InductiveType) (indFVars : Array Expr) : MetaM Nat 
goal: Lean.MetaM Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.fixedIndicesToParams.go
code: /--
  Convert fixed indices to parameters.
-/
private partial def fixedIndicesToParams (numParams : Nat) (indTypes : Array InductiveType) (indFVars : Array Expr) : MetaM Nat 
goal: Lean.MetaM Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.mkInductiveDecl
code: private def mkInductiveDecl (vars : Array Expr) (views : Array InductiveView) : TermElabM Unit 
goal: Lean.Elab.TermElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.applyDerivingHandlers
code: private def applyDerivingHandlers (views : Array InductiveView) : CommandElabM Unit 
goal: Lean.Elab.Command.CommandElabM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Elab.Inductive.0.Lean.Elab.Command.applyComputedFields
code: private def applyComputedFields (indViews : Array InductiveView) : CommandElabM Unit 
goal: Lean.Elab.Command.CommandElabM Unit

full_name: Lean.Elab.Command.elabInductiveViews
code: def elabInductiveViews (views : Array InductiveView) : CommandElabM Unit 
goal: Lean.Elab.Command.CommandElabM Unit