pi/tests/nat-id.pi

24 lines
932 B
Plaintext
Raw Normal View History

let add :
-ind (λ_. ) (λn.n) (λn.λan.λm. suc (an m))
2022-07-27 00:28:06 +02:00
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)
2022-07-26 07:57:44 +02:00
(λ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))
2022-07-26 07:57:44 +02:00
(λn.λpn.λm.λp. ap (λm. suc m) (add (add n m) p) (add n (add m p)) (pn m p))