2023-04-17 15:44:16 -04:00
|
|
|
|
def dup-ℕ : 1.ℕ → [ω.ℕ] =
|
2023-04-01 13:16:30 -04:00
|
|
|
|
λ n ⇒
|
|
|
|
|
case1 n return [ω.ℕ] of {
|
|
|
|
|
zero ⇒ [zero];
|
|
|
|
|
succ _, 1.d ⇒
|
|
|
|
|
case1 d return [ω.ℕ] of { [d] ⇒ [succ d] }
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-17 15:44:16 -04:00
|
|
|
|
def plus : 1.ℕ → 1.ℕ → ℕ =
|
2023-04-01 13:16:30 -04:00
|
|
|
|
λ m n ⇒
|
|
|
|
|
case1 m return ℕ of {
|
|
|
|
|
zero ⇒ n;
|
|
|
|
|
succ _, 1.p ⇒ succ p
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-17 15:44:16 -04:00
|
|
|
|
def times-ω : 1.ℕ → ω.ℕ → ℕ =
|
2023-04-01 13:16:30 -04:00
|
|
|
|
λ m n ⇒
|
|
|
|
|
case1 m return ℕ of {
|
|
|
|
|
zero ⇒ zero;
|
|
|
|
|
succ _, 1.t ⇒ plus n t
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-17 15:44:16 -04:00
|
|
|
|
def times : 1.ℕ → 1.ℕ → ℕ =
|
2023-04-01 13:16:30 -04:00
|
|
|
|
λ m n ⇒
|
|
|
|
|
case1 dup-ℕ n return ℕ of {
|
|
|
|
|
[n] ⇒ times-ω m n
|
|
|
|
|
};
|
|
|
|
|
|
2023-04-17 15:44:16 -04:00
|
|
|
|
def pred : 1.ℕ → ℕ =
|
2023-04-01 13:16:30 -04:00
|
|
|
|
λ n ⇒
|
|
|
|
|
case1 n return ℕ of { zero ⇒ zero; succ n ⇒ n };
|
|
|
|
|
|
|
|
|
|
def0 pred-succ : ω.(n : ℕ) → pred (succ n) ≡ n : ℕ =
|
|
|
|
|
λ n ⇒ δ i ⇒ n;
|
2023-04-17 15:44:16 -04:00
|
|
|
|
|
|
|
|
|
def0 succ-inj : 0.(m : ℕ) → 0.(n : ℕ) →
|
|
|
|
|
0.(succ m ≡ succ n : ℕ) → m ≡ n : ℕ =
|
|
|
|
|
λ m n eq ⇒ δ i ⇒ pred (eq @i);
|