Given a definition `foo`, they were previously called `foo._unfold` until 4.7.0. We tried to rename them to `foo.def`, but it created too many issues in the Mathlib repo. We decided to rename it again to `foo.eq_def`. The new name is also consistent with the `eq_<idx>` theorems generated for different "cases". That is, `foo.eq_def` is the equality theorem for the whole definition, and `foo.eq_<idx>` is the equality theorem for case `<idx>`. cc @semorrison
40 lines
697 B
Text
40 lines
697 B
Text
import Lean
|
|
|
|
open Lean
|
|
open Lean.Meta
|
|
def tst (declName : Name) : MetaM Unit := do
|
|
IO.println (← getUnfoldEqnFor? declName)
|
|
|
|
mutual
|
|
def g (i j : Nat) : Nat :=
|
|
if i < 5 then 0 else
|
|
match j with
|
|
| Nat.zero => 1
|
|
| Nat.succ j => h i j
|
|
termination_by (i + j, 0)
|
|
decreasing_by
|
|
simp_wf
|
|
· apply Prod.Lex.left
|
|
apply Nat.lt_succ_self
|
|
|
|
def h (i j : Nat) : Nat :=
|
|
match j with
|
|
| 0 => g i 0
|
|
| Nat.succ j => g i j
|
|
termination_by (i + j, 1)
|
|
decreasing_by
|
|
all_goals simp_wf
|
|
· apply Prod.Lex.right
|
|
decide
|
|
· apply Prod.Lex.left
|
|
apply Nat.lt_succ_self
|
|
end
|
|
|
|
#eval tst ``g
|
|
#check g.eq_1
|
|
#check g.eq_2
|
|
#check g.eq_def
|
|
#eval tst ``h
|
|
#check h.eq_1
|
|
#check h.eq_2
|
|
#check h.eq_def
|