2022-07-26 06:09:57 +02:00
|
|
|
|
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
|
|
|
|
|
|
2022-07-26 06:09:57 +02:00
|
|
|
|
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)
|
2022-07-26 06:09:57 +02:00
|
|
|
|
|
|
|
|
|
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))
|