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

full_name: Lean.Meta.IndPredBelow.maxBackwardChainingDepth
code: register_builtin_option maxBackwardChainingDepth : Nat := {
    defValue := 10
    descr    := "The maximum search depth used in the backwards chaining part of the proof of `brecOn` for inductive predicates."
  }
goal: Lean.Option Nat

full_name: Lean.Meta.IndPredBelow.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.IndPredBelow._hyg.7
code: register_builtin_option maxBackwardChainingDepth : Nat := {
    defValue := 10
    descr    := "The maximum search depth used in the backwards chaining part of the proof of `brecOn` for inductive predicates."
  }
goal: IO (Lean.Option Nat)

full_name: Lean.Meta.IndPredBelow.Context.belowNames
code: /--
  The context used in the creation of the `below` scheme for inductive predicates.
-/
structure Context where
  motives : Array (Name × Expr)
  typeInfos : Array InductiveVal
  belowNames : Array Name
  headers : Array Expr
  numParams : Nat
goal: Array Lean.Name

full_name: Lean.Meta.IndPredBelow.Context.typeInfos
code: /--
  The context used in the creation of the `below` scheme for inductive predicates.
-/
structure Context where
  motives : Array (Name × Expr)
  typeInfos : Array InductiveVal
  belowNames : Array Name
  headers : Array Expr
  numParams : Nat
goal: Array Lean.InductiveVal

full_name: Lean.Meta.IndPredBelow.Context.numParams
code: /--
  The context used in the creation of the `below` scheme for inductive predicates.
-/
structure Context where
  motives : Array (Name × Expr)
  typeInfos : Array InductiveVal
  belowNames : Array Name
  headers : Array Expr
  numParams : Nat
goal: Nat

full_name: Lean.Meta.IndPredBelow.Context.headers
code: /--
  The context used in the creation of the `below` scheme for inductive predicates.
-/
structure Context where
  motives : Array (Name × Expr)
  typeInfos : Array InductiveVal
  belowNames : Array Name
  headers : Array Expr
  numParams : Nat
goal: Array Lean.Expr

full_name: Lean.Meta.IndPredBelow.Context.motives
code: /--
  The context used in the creation of the `below` scheme for inductive predicates.
-/
structure Context where
  motives : Array (Name × Expr)
  typeInfos : Array InductiveVal
  belowNames : Array Name
  headers : Array Expr
  numParams : Nat
goal: Array (Lean.Name × Lean.Expr)

full_name: Lean.Meta.IndPredBelow.Context
code: /--
  The context used in the creation of the `below` scheme for inductive predicates.
-/
structure Context where
  motives : Array (Name × Expr)
  typeInfos : Array InductiveVal
  belowNames : Array Name
  headers : Array Expr
  numParams : Nat
goal: Type

full_name: Lean.Meta.IndPredBelow.Variables.indVal
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Meta.IndPredBelow.Variables.args
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Meta.IndPredBelow.Variables.params
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Meta.IndPredBelow.Variables.target
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Meta.IndPredBelow.Variables.motives
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Array Lean.Expr

full_name: Lean.Meta.IndPredBelow.instInhabitedVariables
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Inhabited Lean.Meta.IndPredBelow.Variables

full_name: Lean.Meta.IndPredBelow.Variables
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Type

full_name: Lean.Meta.IndPredBelow.Variables.innerType
code: /--
  Collection of variables used to keep track of the positions of binders in the construction
  of `below` motives and constructors.
-/
structure Variables where
  target : Array Expr
  indVal : Array Expr
  params : Array Expr
  args : Array Expr
  motives : Array Expr
  innerType : Expr
  deriving Inhabited
goal: Lean.Expr

full_name: Lean.Meta.IndPredBelow.BrecOnVariables.indices
code: /--
  Collection of variables used to keep track of the local context used in the `brecOn` proof.
-/
structure BrecOnVariables where
  params : Array FVarId
  motives : Array FVarId
  indices : Array FVarId
  witness : FVarId
  indHyps : Array FVarId
goal: Array Lean.FVarId

full_name: Lean.Meta.IndPredBelow.BrecOnVariables.witness
code: /--
  Collection of variables used to keep track of the local context used in the `brecOn` proof.
-/
structure BrecOnVariables where
  params : Array FVarId
  motives : Array FVarId
  indices : Array FVarId
  witness : FVarId
  indHyps : Array FVarId
goal: Lean.FVarId

full_name: Lean.Meta.IndPredBelow.BrecOnVariables.params
code: /--
  Collection of variables used to keep track of the local context used in the `brecOn` proof.
-/
structure BrecOnVariables where
  params : Array FVarId
  motives : Array FVarId
  indices : Array FVarId
  witness : FVarId
  indHyps : Array FVarId
goal: Array Lean.FVarId

full_name: Lean.Meta.IndPredBelow.BrecOnVariables.motives
code: /--
  Collection of variables used to keep track of the local context used in the `brecOn` proof.
-/
structure BrecOnVariables where
  params : Array FVarId
  motives : Array FVarId
  indices : Array FVarId
  witness : FVarId
  indHyps : Array FVarId
goal: Array Lean.FVarId

full_name: Lean.Meta.IndPredBelow.BrecOnVariables.indHyps
code: /--
  Collection of variables used to keep track of the local context used in the `brecOn` proof.
-/
structure BrecOnVariables where
  params : Array FVarId
  motives : Array FVarId
  indices : Array FVarId
  witness : FVarId
  indHyps : Array FVarId
goal: Array Lean.FVarId

full_name: Lean.Meta.IndPredBelow.BrecOnVariables
code: /--
  Collection of variables used to keep track of the local context used in the `brecOn` proof.
-/
structure BrecOnVariables where
  params : Array FVarId
  motives : Array FVarId
  indices : Array FVarId
  witness : FVarId
  indHyps : Array FVarId
goal: Type

full_name: Lean.Meta.IndPredBelow.mkContext.motiveName
code: def mkContext (declName : Name) : MetaM Context 
goal: Lean.MetaM Lean.Name

full_name: Lean.Meta.IndPredBelow.mkContext.mkIndValConst
code: def mkContext (declName : Name) : MetaM Context 
goal: Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkContext.motiveType
code: def mkContext (declName : Name) : MetaM Context 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkContext
code: def mkContext (declName : Name) : MetaM Context 
goal: Lean.MetaM Lean.Meta.IndPredBelow.Context

full_name: Lean.Meta.IndPredBelow.mkContext.addMotives
code: def mkContext (declName : Name) : MetaM Context 
goal: Lean.Expr → Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkContext.mkHeader
code: def mkContext (declName : Name) : MetaM Context 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkCtorType.rebuild
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkCtorType.copyVarName
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Lean.Name

full_name: Lean.Meta.IndPredBelow.mkCtorType.mkBelowBinder
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM α

full_name: Lean.Meta.IndPredBelow.mkCtorType.mkMotiveBinder
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM α

full_name: Lean.Meta.IndPredBelow.mkCtorType.replaceTempVars
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkCtorType.checkCount
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Bool

full_name: Lean.Meta.IndPredBelow.mkCtorType.addMotives
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkCtorType
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkCtorType.modifyBinders
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkCtorType.addHeaderVars
code: partial def mkCtorType
    (ctx : Context)
    (belowIdx : Nat)
    (originalCtor : ConstructorVal) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkConstructor
code: def mkConstructor (ctx : Context) (i : Nat) (ctor : Name) : MetaM Constructor 
goal: Lean.MetaM Lean.Constructor

full_name: Lean.Meta.IndPredBelow.mkInductiveType
code: def mkInductiveType
    (ctx : Context)
    (i : Fin ctx.typeInfos.size)
    (indVal : InductiveVal) : MetaM InductiveType 
goal: Lean.MetaM Lean.InductiveType

full_name: Lean.Meta.IndPredBelow.mkBelowDecl
code: def mkBelowDecl (ctx : Context) : MetaM Declaration 
goal: Lean.MetaM Lean.Declaration

full_name: Lean.Meta.IndPredBelow.backwardsChaining
code: partial def backwardsChaining (m : MVarId) (depth : Nat) : MetaM Bool 
goal: Lean.MetaM Bool

full_name: Lean.Meta.IndPredBelow.proveBrecOn.applyIH
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM (List Lean.MVarId)

full_name: Lean.Meta.IndPredBelow.proveBrecOn.intros
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM (Lean.MVarId × Lean.Meta.IndPredBelow.BrecOnVariables)

full_name: Lean.Meta.IndPredBelow.proveBrecOn
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.proveBrecOn.applyCtors
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM (List Lean.MVarId)

full_name: Lean.Meta.IndPredBelow.proveBrecOn.closeGoal
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM Unit

full_name: Lean.Meta.IndPredBelow.proveBrecOn.induction
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM (List Lean.MVarId)

full_name: Lean.Meta.IndPredBelow.proveBrecOn.introNPRec
code: partial def proveBrecOn (ctx : Context) (indVal : InductiveVal) (type : Expr) : MetaM Expr 
goal: Lean.MetaM Lean.MVarId

full_name: Lean.Meta.IndPredBelow.mkBrecOnDecl.mkIH
code: def mkBrecOnDecl (ctx : Context) (idx : Nat) : MetaM Declaration 
goal: Lean.MetaM (Lean.Name × (Array Lean.Expr → Lean.MetaM Lean.Expr))

full_name: Lean.Meta.IndPredBelow.mkBrecOnDecl
code: def mkBrecOnDecl (ctx : Context) (idx : Nat) : MetaM Declaration 
goal: Lean.MetaM Lean.Declaration

full_name: Lean.Meta.IndPredBelow.mkBrecOnDecl.mkType
code: def mkBrecOnDecl (ctx : Context) (idx : Nat) : MetaM Declaration 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.getBelowIndices
code: /-- Given a constructor name, find the indices of the corresponding `below` version thereof. -/
partial def getBelowIndices (ctorName : Name) : MetaM $ Array Nat 
goal: Lean.MetaM (Array Nat)

full_name: Lean.Meta.IndPredBelow.getBelowIndices.loop
code: /-- Given a constructor name, find the indices of the corresponding `below` version thereof. -/
partial def getBelowIndices (ctorName : Name) : MetaM $ Array Nat 
goal: Lean.MetaM (Array Nat)

full_name: _private.«.lake».packages.lean4.src.lean.Lean.Meta.IndPredBelow.0.Lean.Meta.IndPredBelow.belowType
code: private def belowType (motive : Expr) (xs : Array Expr) (idx : Nat) : MetaM $ Name × Expr 
goal: Lean.MetaM (Lean.Name × Lean.Expr)

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher.addBelowPattern
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.MetaM Lean.Meta.Match.AltLHS

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher.convertToBelow
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.MetaM (Array Lean.LocalDecl × Lean.Meta.Match.Pattern)

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher.newMotive
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.MetaM Lean.Expr

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher.transformFields.loop
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.MetaM (Array Lean.LocalDecl × Array Lean.Meta.Match.Pattern)

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher.toInaccessible
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.Meta.Match.Pattern → Lean.MetaM Lean.Meta.Match.Pattern

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher.transformFields
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.MetaM (Array Lean.LocalDecl × Array Lean.Meta.Match.Pattern)

full_name: Lean.Meta.IndPredBelow.mkBelowMatcher
code: /-- This function adds an additional `below` discriminant to a matcher application.
    It is used for modifying the patterns, such that the structural recursion can use the new
    `below` predicate instead of the original one and thus be used prove structural recursion.

    It takes as parameters:
    - matcherApp: a matcher application
    - belowMotive: the motive, that the `below` type should carry
    - below: an expression from the local context that is the `below` version of a predicate
             and can be used for structural recursion
    - idx: the index of the original predicate discriminant.

    It returns:
    - A matcher application as an expression
    - A side-effect for adding the matcher to the environment -/
partial def mkBelowMatcher
    (matcherApp : MatcherApp)
    (belowMotive : Expr)
    (below : Expr)
    (idx : Nat) : MetaM $ Expr × MetaM Unit 
goal: Lean.MetaM (Lean.Expr × Lean.MetaM Unit)

full_name: Lean.Meta.IndPredBelow.findBelowIdx
code: def findBelowIdx (xs : Array Expr) (motive : Expr) : MetaM $ Option (Expr × Nat) 
goal: Lean.MetaM (Option (Lean.Expr × Nat))

full_name: Lean.Meta.IndPredBelow.mkBelow
code: /-- Generates the auxiliary lemmas `below` and `brecOn` for a recursive inductive predicate.
The current generator doesn't support nested predicates, but pattern-matching on them still works
thanks to well-founded recursion. -/
def mkBelow (declName : Name) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: Lean.Meta.IndPredBelow.initFn._@..lake.packages.lean4.src.lean.Lean.Meta.IndPredBelow._hyg.7660
code: builtin_initialize
  registerTraceClass `Meta.IndPredBelow
  registerTraceClass `Meta.IndPredBelow.match
goal: IO Unit