lean4-htt/tests/lean/run/structuralEqns2.lean
Leonardo de Moura 22b5c957e9
chore: rename automatically generated "unfold" theorems (#3767)
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
2024-03-25 21:41:26 +00:00

29 lines
464 B
Text

import Lean
open Lean
open Lean.Meta
def tst (declName : Name) : MetaM Unit := do
IO.println (← getUnfoldEqnFor? declName)
def g (i j : Nat) : Nat :=
if i < 5 then 0 else
match j with
| Nat.zero => 1
| Nat.succ j => g i j
#eval tst ``g
#check g.eq_1
#check g.eq_2
#check g.eq_def
def h (i j : Nat) : Nat :=
let z :=
match j with
| Nat.zero => 1
| Nat.succ j => h i j
z + z
#eval tst ``h
#check h.eq_1
#check h.eq_2
#check h.eq_def