Support for termination_by
notation #
A single termination_by
clause
- ref : Lean.Syntax
- structural : Bool
- vars : Lean.TSyntaxArray [`ident, `Lean.Parser.Term.hole]
- body : Lean.Term
- synthetic : Bool
Instances For
Equations
- Lean.Elab.instInhabitedTerminationBy = { default := { ref := default, structural := default, vars := default, body := default, synthetic := default } }
A single decreasing_by
clause
- ref : Lean.Syntax
- tactic : Lean.TSyntax `Lean.Parser.Tactic.tacticSeq
Instances For
Equations
- Lean.Elab.instInhabitedDecreasingBy = { default := { ref := default, tactic := default } }
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.
- ref : Lean.Syntax
- terminationBy?? : Option Lean.Syntax
- terminationBy? : Option Lean.Elab.TerminationBy
- decreasingBy? : Option Lean.Elab.DecreasingBy
- extraParams : Nat
Here we record the number of parameters past the
:
. It is set byTerminationHints.rememberExtraParams
and used as follows:- 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
).
- When we guess the termination argument in
Instances For
Equations
- One or more equations did not get rendered due to their size.
Equations
- Lean.Elab.TerminationHints.none = { ref := Lean.Syntax.missing, terminationBy?? := none, terminationBy? := none, decreasingBy? := none, extraParams := 0 }
Instances For
Logs warnings when the TerminationHints
are unexpectedly present.
Equations
- One or more equations did not get rendered due to their size.
Instances For
True if any form of termination hint is present.
Equations
Instances For
Remembers extraParams
for later use. Needs to happen early enough where we still know
how many parameters came from the function header (headerParams
).
Equations
- One or more equations did not get rendered due to their size.
Instances For
Checks that termination_by
binds at most as many variables are present in the outermost
lambda of value
, and throws appropriate errors.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- Lean.Elab.TerminationBy.checkVars.parameters 1 = (Lean.MessageData.ofFormat ∘ Lean.format) "one parameter"
- Lean.Elab.TerminationBy.checkVars.parameters x✝ = Lean.toMessageData "" ++ Lean.toMessageData x✝ ++ Lean.toMessageData " parameters"
Instances For
Takes apart a Termination.suffix
syntax object
Equations
- One or more equations did not get rendered due to their size.