pi/tests/nat-id.pi

24 lines
932 B
Plaintext
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.

let add :
-ind (λ_. ) (λn.n) (λn.λan.λm. suc (an m))
let add_test : Id (add 2 2) 4
≔ refl 4
let add_id_l : Π (n : ) Id n (add 0 n)
≔ λn. refl n
let ap : Π (A : Type) Π (B : Type) Π (f : A → B)
Π (x : A) Π (y : A) Id A x y → Id B (f x) (f y)
≔ λA.λB.λf.λx.λy. J A x y (λa.λb.λ_. Id B (f a) (f b)) (refl B (f x))
let add_id_r : Π (n : ) Id n (add n 0)
-ind (λn. Id n (add n 0))
(refl 0)
(λn.λp. ap (λm. suc m) n (add n 0) p)
let add_assoc : Π (n : ) Π (m : ) Π (p : )
Id (add (add n m) p) (add n (add m p))
-ind (λn. Π (m : ) Π (p : ) Id (add (add n m) p) (add n (add m p)))
(λm.λp. refl (add m p))
(λn.λpn.λm.λp. ap (λm. suc m) (add (add n m) p) (add n (add m p)) (pn m p))