lean4-htt/tests/lean/run/simpAutoUnfold.lean
Leonardo de Moura 4848ad4869 feat: implement autoUnfold at simp
Right now, it only supports the following kind of definitions
- Recursive definitions that support smart unfolding.
- Non-recursive definitions where the body is a match-expression. This
kind of definition is only unfolded if the match can be reduced.
2022-04-18 16:51:52 -07:00

37 lines
984 B
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

def append (as bs : List α) : List α :=
match as with
| [] => bs
| a :: as => a :: append as bs
theorem append_nil (as : List α) : append as [] = as := by
induction as <;> simp_all!
theorem append_nil' (as : List α) : append as [] = as := by
induction as <;> simp! [*]
theorem append_assoc (as bs cs : List α) : append (append as bs) cs = append as (append bs cs) := by
induction as <;> simp_all!
theorem append_assoc' (as bs cs : List α) : append (append as bs) cs = append as (append bs cs) := by
induction as <;> simp! [*]
def g : Nat → Nat
| 0 => 1
| n+1 => n + 2
example (a : Nat) : g a > 0 := by
cases a <;> simp_arith!
example (a : Nat) : g a > 0 := by
cases a <;> simp_arith!
example (a : Nat) : g a > 0 := by
cases a <;> simp_arith! [-g]
simp_arith!
example (a : Nat) (h : b + 2 = 2) : g a > b := by
cases a <;> simp_all_arith!
example (a : Nat) (h : b + 2 = 2) : g a > b := by
cases a <;> simp_all_arith! [-g]
simp_arith!