File: .lake/packages/lean4/src/lean/Lean/Elab/PreDefinition/WF/TerminationHint.lean

full_name: Lean.Elab.WF.TerminationBy.body
code: /-- A single `termination_by` clause -/
structure TerminationBy where
  ref       : Syntax
  vars      : TSyntaxArray [`ident, ``Lean.Parser.Term.hole]
  body      : Term
  /--
  If `synthetic := true`, then this `termination_by` clause was
  generated by `GuessLex`, and `vars` refers to *all* parameters
  of the function, not just the “extra parameters”.
  Cf. Lean.Elab.WF.unpackUnary
  -/
  synthetic : Bool := false
  deriving Inhabited
goal: Lean.Term

full_name: Lean.Elab.WF.TerminationBy.ref
code: /-- A single `termination_by` clause -/
structure TerminationBy where
  ref       : Syntax
  vars      : TSyntaxArray [`ident, ``Lean.Parser.Term.hole]
  body      : Term
  /--
  If `synthetic := true`, then this `termination_by` clause was
  generated by `GuessLex`, and `vars` refers to *all* parameters
  of the function, not just the “extra parameters”.
  Cf. Lean.Elab.WF.unpackUnary
  -/
  synthetic : Bool := false
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.WF.instInhabitedTerminationBy
code: /-- A single `termination_by` clause -/
structure TerminationBy where
  ref       : Syntax
  vars      : TSyntaxArray [`ident, ``Lean.Parser.Term.hole]
  body      : Term
  /--
  If `synthetic := true`, then this `termination_by` clause was
  generated by `GuessLex`, and `vars` refers to *all* parameters
  of the function, not just the “extra parameters”.
  Cf. Lean.Elab.WF.unpackUnary
  -/
  synthetic : Bool := false
  deriving Inhabited
goal: Inhabited Lean.Elab.WF.TerminationBy

full_name: Lean.Elab.WF.TerminationBy.synthetic
code: /-- A single `termination_by` clause -/
structure TerminationBy where
  ref       : Syntax
  vars      : TSyntaxArray [`ident, ``Lean.Parser.Term.hole]
  body      : Term
  /--
  If `synthetic := true`, then this `termination_by` clause was
  generated by `GuessLex`, and `vars` refers to *all* parameters
  of the function, not just the “extra parameters”.
  Cf. Lean.Elab.WF.unpackUnary
  -/
  synthetic : Bool := false
  deriving Inhabited
goal: Bool

full_name: Lean.Elab.WF.TerminationBy
code: /-- A single `termination_by` clause -/
structure TerminationBy where
  ref       : Syntax
  vars      : TSyntaxArray [`ident, ``Lean.Parser.Term.hole]
  body      : Term
  /--
  If `synthetic := true`, then this `termination_by` clause was
  generated by `GuessLex`, and `vars` refers to *all* parameters
  of the function, not just the “extra parameters”.
  Cf. Lean.Elab.WF.unpackUnary
  -/
  synthetic : Bool := false
  deriving Inhabited
goal: Type

full_name: Lean.Elab.WF.TerminationBy.vars
code: /-- A single `termination_by` clause -/
structure TerminationBy where
  ref       : Syntax
  vars      : TSyntaxArray [`ident, ``Lean.Parser.Term.hole]
  body      : Term
  /--
  If `synthetic := true`, then this `termination_by` clause was
  generated by `GuessLex`, and `vars` refers to *all* parameters
  of the function, not just the “extra parameters”.
  Cf. Lean.Elab.WF.unpackUnary
  -/
  synthetic : Bool := false
  deriving Inhabited
goal: Lean.TSyntaxArray [`ident, `Lean.Parser.Term.hole]

full_name: Lean.Elab.WF.instInhabitedDecreasingBy
code: /-- A single `decreasing_by` clause -/
structure DecreasingBy where
  ref       : Syntax
  tactic    : TSyntax ``Lean.Parser.Tactic.tacticSeq
  deriving Inhabited
goal: Inhabited Lean.Elab.WF.DecreasingBy

full_name: Lean.Elab.WF.DecreasingBy.ref
code: /-- A single `decreasing_by` clause -/
structure DecreasingBy where
  ref       : Syntax
  tactic    : TSyntax ``Lean.Parser.Tactic.tacticSeq
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.WF.DecreasingBy
code: /-- A single `decreasing_by` clause -/
structure DecreasingBy where
  ref       : Syntax
  tactic    : TSyntax ``Lean.Parser.Tactic.tacticSeq
  deriving Inhabited
goal: Type

full_name: Lean.Elab.WF.DecreasingBy.tactic
code: /-- A single `decreasing_by` clause -/
structure DecreasingBy where
  ref       : Syntax
  tactic    : TSyntax ``Lean.Parser.Tactic.tacticSeq
  deriving Inhabited
goal: Lean.TSyntax `Lean.Parser.Tactic.tacticSeq

full_name: Lean.Elab.WF.instInhabitedTerminationHints
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Inhabited Lean.Elab.WF.TerminationHints

full_name: Lean.Elab.WF.TerminationHints
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Type

full_name: Lean.Elab.WF.TerminationHints.terminationBy?
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Option Lean.Elab.WF.TerminationBy

full_name: Lean.Elab.WF.TerminationHints.decreasingBy?
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Option Lean.Elab.WF.DecreasingBy

full_name: Lean.Elab.WF.TerminationHints.extraParams
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Nat

full_name: Lean.Elab.WF.TerminationHints.terminationBy??
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Option Lean.Syntax

full_name: Lean.Elab.WF.TerminationHints.ref
code: /-- The termination annotations for a single function.
For `decreasing_by`, we store the whole `decreasing_by tacticSeq` expression, as this
is what `Term.runTactic` expects.
 -/
structure TerminationHints where
  ref : Syntax
  terminationBy?? : Option Syntax
  terminationBy? : Option TerminationBy
  decreasingBy?  : Option DecreasingBy
  /-- Here we record the number of parameters past the `:`. It is set by
  `TerminationHints.rememberExtraParams` and used as folows:

  * When we guess the termination argument in `GuessLex` and want to print it in surface-syntax
    compatible form.
  * If there are fewer variables in the `termination_by` annotation than there are extra
    parameters, we know which parameters they should apply to (`TerminationBy.checkVars`).
  -/
  extraParams : Nat
  deriving Inhabited
goal: Lean.Syntax

full_name: Lean.Elab.WF.TerminationHints.none
code: def TerminationHints.none : TerminationHints 
goal: Lean.Elab.WF.TerminationHints

full_name: Lean.Elab.WF.TerminationHints.ensureNone
code: /-- Logs warnings when the `TerminationHints` are present.  -/
def TerminationHints.ensureNone (hints : TerminationHints) (reason : String): CoreM Unit 
goal: Lean.CoreM Unit

full_name: Lean.Elab.WF.TerminationHints.isNotNone
code: /-- True if any form of termination hint is present. -/
def TerminationHints.isNotNone (hints : TerminationHints) : Bool 
goal: Bool

full_name: Lean.Elab.WF.TerminationHints.rememberExtraParams
code: /--
Remembers `extraParams` for later use. Needs to happen early enough where we still know
how many parameters came from the function header (`headerParams`).
-/
def TerminationHints.rememberExtraParams (headerParams : Nat) (hints : TerminationHints)
    (value : Expr) : TerminationHints 
goal: Lean.Elab.WF.TerminationHints

full_name: Lean.Elab.WF.TerminationBy.checkVars.parameters
code: /--
Checks that `termination_by` binds at most as many variables are present in the outermost
lambda of `value`, and throws appropriate errors.
-/
def TerminationBy.checkVars (funName : Name) (extraParams : Nat) (tb : TerminationBy) : MetaM Unit 
goal: Nat → Lean.MessageData

full_name: Lean.Elab.WF.TerminationBy.checkVars
code: /--
Checks that `termination_by` binds at most as many variables are present in the outermost
lambda of `value`, and throws appropriate errors.
-/
def TerminationBy.checkVars (funName : Name) (extraParams : Nat) (tb : TerminationBy) : MetaM Unit 
goal: Lean.MetaM Unit

full_name: Lean.Elab.WF.elabTerminationHints
code: /-- Takes apart a `Termination.suffix` syntax object -/
def elabTerminationHints {m} [Monad m] [MonadError m] (stx : TSyntax ``suffix) : m TerminationHints 
goal: m Lean.Elab.WF.TerminationHints