39 lines
No EOL
1 KiB
Agda
39 lines
No EOL
1 KiB
Agda
{-# OPTIONS --cubical #-}
|
||
|
||
open import Cubical.Foundations.Prelude
|
||
|
||
data ℕ : Set where
|
||
zero : ℕ
|
||
suc : ℕ → ℕ
|
||
|
||
add : ℕ → ℕ → ℕ
|
||
add zero n = n
|
||
add (suc m) n = add m (suc n)
|
||
|
||
data ℤ₀ : Set where
|
||
pos : ℕ → ℤ₀
|
||
negsuc : ℕ → ℤ₀
|
||
|
||
data ℤ : Set where
|
||
z : ℕ → ℕ → ℤ
|
||
p : (m n : ℕ) → z m n ≡ z (suc m) (suc n)
|
||
|
||
ℤ→ℤ₀ : ℤ → ℤ₀
|
||
ℤ→ℤ₀ (z zero zero) = pos zero
|
||
ℤ→ℤ₀ (z zero (suc x₁)) = negsuc x₁
|
||
ℤ→ℤ₀ (z (suc x) zero) = pos (suc x)
|
||
ℤ→ℤ₀ (z (suc x) (suc x₁)) = ℤ→ℤ₀ (z x x₁)
|
||
ℤ→ℤ₀ (p m n i) = ℤ→ℤ₀ {! !}
|
||
|
||
ℤ₀→ℤ : ℤ₀ → ℤ
|
||
ℤ₀→ℤ (pos x) = z x zero
|
||
ℤ₀→ℤ (negsuc x) = z zero (suc x)
|
||
|
||
ap : ∀ {A B x y} → (f : A → B) → (x ≡ y) → (f x ≡ f y)
|
||
ap f x i = f (x i)
|
||
|
||
add-ℤ : ℤ → ℤ → ℤ
|
||
add-ℤ (z x x₁) (z x₂ x₃) = z (add x x₂) (add x₁ x₃)
|
||
add-ℤ (z x x₁) (p m n i) = z (add x {! !}) {! !}
|
||
add-ℤ (p m n i) (z x x₁) = {! !}
|
||
add-ℤ (p m n i) (p m₁ n₁ i₁) = {! !} |