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

full_name: Lean.Meta.RecursorUnivLevelPos
code: inductive RecursorUnivLevelPos where
  | motive                -- marks where the universe of the motive should go
  | majorType (idx : Nat)
goal: Type

full_name: Lean.Meta.RecursorUnivLevelPos.majorType
code: inductive RecursorUnivLevelPos where
  | motive                -- marks where the universe of the motive should go
  | majorType (idx : Nat)
goal: Lean.Meta.RecursorUnivLevelPos

full_name: Lean.Meta.RecursorUnivLevelPos.motive
code: inductive RecursorUnivLevelPos where
  | motive                -- marks where the universe of the motive should go
  | majorType (idx : Nat)
goal: Lean.Meta.RecursorUnivLevelPos

full_name: Lean.Meta.instToStringRecursorUnivLevelPos
code: instance : ToString RecursorUnivLevelPos 
goal: ToString Lean.Meta.RecursorUnivLevelPos

full_name: Lean.Meta.RecursorInfo.indicesPos
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: List Nat

full_name: Lean.Meta.RecursorInfo.recursorName
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Lean.Name

full_name: Lean.Meta.RecursorInfo
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Type

full_name: Lean.Meta.RecursorInfo.typeName
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Lean.Name

full_name: Lean.Meta.RecursorInfo.univLevelPos
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: List Lean.Meta.RecursorUnivLevelPos

full_name: Lean.Meta.RecursorInfo.numArgs
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Nat

full_name: Lean.Meta.RecursorInfo.produceMotive
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: List Bool

full_name: Lean.Meta.RecursorInfo.recursive
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Bool

full_name: Lean.Meta.RecursorInfo.depElim
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Bool

full_name: Lean.Meta.RecursorInfo.majorPos
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: Nat

full_name: Lean.Meta.RecursorInfo.paramsPos
code: structure RecursorInfo where
  recursorName  : Name
  typeName      : Name
  univLevelPos  : List RecursorUnivLevelPos
  depElim       : Bool
  recursive     : Bool
  numArgs       : Nat -- Total number of arguments
  majorPos      : Nat
  paramsPos     : List (Option Nat) -- Position of the recursor parameters in the major premise, instance implicit arguments are `none`
  indicesPos    : List Nat -- Position of the recursor indices in the major premise
  produceMotive : List Bool
goal: List (Option Nat)

full_name: Lean.Meta.RecursorInfo.numParams
code: def numParams (info : RecursorInfo) : Nat 
goal: Nat

full_name: Lean.Meta.RecursorInfo.numIndices
code: def numIndices (info : RecursorInfo) : Nat 
goal: Nat

full_name: Lean.Meta.RecursorInfo.motivePos
code: def motivePos (info : RecursorInfo) : Nat 
goal: Nat

full_name: Lean.Meta.RecursorInfo.firstIndexPos
code: def firstIndexPos (info : RecursorInfo) : Nat 
goal: Nat

full_name: Lean.Meta.RecursorInfo.isMinor
code: def isMinor (info : RecursorInfo) (pos : Nat) : Bool 
goal: Bool

full_name: Lean.Meta.RecursorInfo.numMinors
code: def numMinors (info : RecursorInfo) : Nat 
goal: Nat

full_name: Lean.Meta.RecursorInfo.instToString
code: instance : ToString RecursorInfo 
goal: ToString Lean.Meta.RecursorInfo

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.mkRecursorInfoForKernelRec
code: private def mkRecursorInfoForKernelRec (declName : Name) (val : RecursorVal) : MetaM RecursorInfo 
goal: Lean.MetaM Lean.Meta.RecursorInfo

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getMajorPosIfAuxRecursor?
code: private def getMajorPosIfAuxRecursor? (declName : Name) (majorPos? : Option Nat) : MetaM (Option Nat) 
goal: Lean.MetaM (Option Nat)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.checkMotive
code: private def checkMotive (declName : Name) (motive : Expr) (motiveArgs : Array Expr) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getNumParams
code: /-- Compute number of parameters for (user-defined) recursor.
   We assume a parameter is anything that occurs before the motive -/
private partial def getNumParams (xs : Array Expr) (motive : Expr) (i : Nat) : Nat 
goal: Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getMajorPosDepElim
code: private def getMajorPosDepElim (declName : Name) (majorPos? : Option Nat) (xs : Array Expr) (motiveArgs : Array Expr)
    : MetaM (Expr × Nat × Bool) 
goal: Lean.MetaM (Lean.Expr × Nat × Bool)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getParamsPos
code: private def getParamsPos (declName : Name) (xs : Array Expr) (numParams : Nat) (Iargs : Array Expr) : MetaM (List (Option Nat)) 
goal: Lean.MetaM (List (Option Nat))

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getIndicesPos
code: private def getIndicesPos (declName : Name) (xs : Array Expr) (majorPos numIndices : Nat) (Iargs : Array Expr) : MetaM (List Nat) 
goal: Lean.MetaM (List Nat)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getMotiveLevel
code: private def getMotiveLevel (declName : Name) (motiveResultType : Expr) : MetaM Level 
goal: Lean.MetaM Lean.Level

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getUnivLevelPos
code: private def getUnivLevelPos (declName : Name) (lparams : List Name) (motiveLvl : Level) (Ilevels : List Level) : MetaM (List RecursorUnivLevelPos) 
goal: Lean.MetaM (List Lean.Meta.RecursorUnivLevelPos)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.getProduceMotiveAndRecursive
code: private def getProduceMotiveAndRecursive (xs : Array Expr) (numParams numIndices majorPos : Nat) (motive : Expr) : MetaM (List Bool × Bool) 
goal: Lean.MetaM (List Bool × Bool)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.checkMotiveResultType
code: private def checkMotiveResultType (declName : Name) (motiveArgs : Array Expr) (motiveResultType : Expr) (motiveTypeParams : Array Expr) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.mkRecursorInfoAux
code: private def mkRecursorInfoAux (cinfo : ConstantInfo) (majorPos? : Option Nat) : MetaM RecursorInfo 
goal: Lean.MetaM Lean.Meta.RecursorInfo

full_name: Lean.Meta.Attribute.Recursor.getMajorPos
code: def Attribute.Recursor.getMajorPos (stx : Syntax) : AttrM Nat 
goal: Lean.AttrM Nat

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.RecursorInfo.0.Lean.Meta.mkRecursorInfoCore
code: private def mkRecursorInfoCore (declName : Name) (majorPos? : Option Nat := none) : MetaM RecursorInfo 
goal: Lean.MetaM Lean.Meta.RecursorInfo

full_name: Lean.Meta.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.RecursorInfo._hyg.2934
code: builtin_initialize recursorAttribute : ParametricAttribute Nat ←
  registerParametricAttribute {
    name := `recursor,
    descr := "user defined recursor, numerical parameter specifies position of the major premise",
    getParam := fun _ stx => Attribute.Recursor.getMajorPos stx
    afterSet := fun declName majorPos => do
      discard <| mkRecursorInfoCore declName (some majorPos) |>.run'
  }
goal: IO (Lean.ParametricAttribute Nat)

full_name: Lean.Meta.recursorAttribute
code: builtin_initialize recursorAttribute : ParametricAttribute Nat ←
  registerParametricAttribute {
    name := `recursor,
    descr := "user defined recursor, numerical parameter specifies position of the major premise",
    getParam := fun _ stx => Attribute.Recursor.getMajorPos stx
    afterSet := fun declName majorPos => do
      discard <| mkRecursorInfoCore declName (some majorPos) |>.run'
  }
goal: Lean.ParametricAttribute Nat

full_name: Lean.Meta.getMajorPos?
code: def getMajorPos? (env : Environment) (declName : Name) : Option Nat 
goal: Option Nat

full_name: Lean.Meta.mkRecursorInfo
code: def mkRecursorInfo (declName : Name) (majorPos? : Option Nat := none) : MetaM RecursorInfo 
goal: Lean.MetaM Lean.Meta.RecursorInfo