{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Data.Conat.PropertiesI where
open import FOTC.Base
open import FOTC.Data.Conat
open import FOTC.Data.Nat
Conat-in : ∀ {n} →
n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ Conat n') →
Conat n
Conat-in h = Conat-coind A h' h
where
A : D → Set
A n = n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ Conat n')
h' : ∀ {n} → A n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n')
h' (inj₁ n≡0) = inj₁ n≡0
h' (inj₂ (n' , prf , Cn')) = inj₂ (n' , prf , Conat-out Cn')
0-Conat : Conat zero
0-Conat = Conat-coind A h refl
where
A : D → Set
A n = n ≡ zero
h : ∀ {n} → A n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n')
h An = inj₁ An
∞-Conat : Conat ∞
∞-Conat = Conat-coind A h refl
where
A : D → Set
A n = n ≡ ∞
h : ∀ {n} → A n → n ≡ zero ∨ (∃[ n' ] n ≡ succ₁ n' ∧ A n')
h An = inj₂ (∞ , trans An ∞-eq , refl)
N→Conat : ∀ {n} → N n → Conat n
N→Conat Nn = Conat-coind N h Nn
where
h : ∀ {m} → N m → m ≡ zero ∨ (∃[ m' ] m ≡ succ₁ m' ∧ N m')
h nzero = inj₁ refl
h (nsucc {m} Nm) = inj₂ (m , refl , Nm)
N→Conat' : ∀ {n} → N n → Conat n
N→Conat' nzero = Conat-in (inj₁ refl)
N→Conat' (nsucc {n} Nn) = Conat-in (inj₂ (n , refl , (N→Conat' Nn)))