fix: registers eqns info before adding definition
Otherwise `[simp]` at definition will fail to generate equational theorems.
This commit is contained in:
parent
7acbbb4fbb
commit
d8d7d63830
2 changed files with 12 additions and 1 deletions
|
|
@ -84,10 +84,10 @@ def structuralRecursion (preDefs : Array PreDefinition) : TermElabM Unit :=
|
|||
let preDefNonRec ← eraseRecAppSyntax preDefNonRec
|
||||
let preDef ← eraseRecAppSyntax preDefs[0]
|
||||
state.addMatchers.forM liftM
|
||||
registerEqnsInfo preDef recArgPos
|
||||
mapError (addNonRec preDefNonRec) (fun msg => m!"structural recursion failed, produced type incorrect term{indentD msg}")
|
||||
addAndCompilePartialRec #[preDef]
|
||||
addSmartUnfoldingDef preDef recArgPos
|
||||
registerEqnsInfo preDef recArgPos
|
||||
|
||||
builtin_initialize
|
||||
registerTraceClass `Elab.definition.structural
|
||||
|
|
|
|||
11
tests/lean/run/simpAtDefIssue.lean
Normal file
11
tests/lean/run/simpAtDefIssue.lean
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
@[simp] def g (x y : Nat) : Nat :=
|
||||
match x, y with
|
||||
| 0, 0 => 1
|
||||
| 0, y => y
|
||||
| x+1, 5 => 2 * g x 0
|
||||
| x+1, y => 2 * g x y
|
||||
|
||||
#check g._eq_1
|
||||
#check g._eq_2
|
||||
#check g._eq_3
|
||||
#check g._eq_4
|
||||
Loading…
Add table
Reference in a new issue