lean4-htt/tests/lean/run/structEqns.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

46 lines
927 B
Text

import Lean
open Lean
open Lean.Meta
def tst (declName : Name) : MetaM Unit := do
IO.println (← getUnfoldEqnFor? declName)
def foo (xs ys zs : List Nat) : List Nat :=
match (xs, ys) with
| (xs', ys') =>
match zs with
| z::zs => foo xs ys zs
| _ => match ys' with
| [] => [1]
| _ => [2]
#eval tst ``foo
/--
info: foo.eq_def (xs ys zs : List Nat) :
foo xs ys zs =
match (xs, ys) with
| (xs', ys') =>
match zs with
| z :: zs => foo xs ys zs
| x =>
match ys' with
| [] => [1]
| x => [2]
-/
#guard_msgs in
#check foo.eq_def
def bar (xs ys : List Nat) : List Nat :=
match xs ++ [], ys ++ [] with
| xs', ys' => xs' ++ ys'
/--
info: def bar : List Nat → List Nat → List Nat :=
fun xs ys =>
match xs ++ [], ys ++ [] with
| xs', ys' => xs' ++ ys'
-/
#guard_msgs in
#print bar -- should not contain either `let _discr` aux binding