lean4-htt/tests/lean/run/def12.lean
Leonardo de Moura 1775d9b04b fix: visit types
See new test `tests/lean/run/def14.lean`
2020-09-25 06:48:51 -07:00

52 lines
1.1 KiB
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.

new_frontend
def diag : Bool → Bool → Bool → Nat
| b, true, false => 1
| false, b, true => 2
| true, false, b => 3
| b1, b2, b3 => arbitrary Nat
theorem diag1 (a : Bool) : diag a true false = 1 :=
match a with
| true => rfl
| false => rfl
theorem diag2 (a : Bool) : diag false a true = 2 :=
by cases a; exact rfl; exact rfl
theorem diag3 (a : Bool) : diag true false a = 3 :=
by cases a; exact rfl; exact rfl
theorem diag4_1 : diag false false false = arbitrary Nat :=
rfl
theorem diag4_2 : diag true true true = arbitrary Nat :=
rfl
def f : Nat → Nat → Nat
| n, 0 => 0
| 0, n => 1
| n, m => arbitrary Nat
theorem f_zero_right : (a : Nat) → f a 0 = 0
| 0 => rfl
| a+1 => rfl
theorem f_zero_succ (a : Nat) : f 0 (a+1) = 1 :=
rfl
theorem f_succ_succ (a b : Nat) : f (a+1) (b+1) = arbitrary Nat :=
rfl
def app {α} : List α → List α → List α
| [], l => l
| h::t, l => h :: (app t l)
theorem app_nil {α} (l : List α) : app [] l = l :=
rfl
theorem app_cons {α} (h : α) (t l : List α) : app (h :: t) l = h :: (app t l) :=
rfl
theorem ex : app [1, 2] [3,4,5] = [1,2,3,4,5] :=
rfl