module Data.PosNat where

open import Data.Product
open import Data.Nat
open import Data.Nat.Properties
open import Data.Unit
open import Relation.Binary.PropositionalEquality

open import Axiom.UniquenessOfIdentityProofs
open import Axiom.UniquenessOfIdentityProofs.Properties

ℕ⁺ : Set
ℕ⁺ = Σ[ n   ] NonZero n

ℕ⁺-cong : {n m : } {p : NonZero n} {q : NonZero m}  n  m  (n , p)  (m , q)
ℕ⁺-cong {suc _} {suc _} {record { nonZero = tt }} {record { nonZero = tt }} refl = refl

suc-lem :  {n m} (p : suc n  suc m)  p  cong suc (suc-injective p)
suc-lem refl = refl

UIP-ℕ : UIP 
UIP-ℕ {zero} {zero} refl refl = refl
UIP-ℕ {suc n} {suc m} p q = trans (trans (suc-lem p) (cong (cong suc) (UIP-ℕ {n} {m} (suc-injective p) (suc-injective q)))) (sym (suc-lem q))

pred⁺ : ℕ⁺  
pred⁺ (suc n , p) = n

suc⁺ :   ℕ⁺
suc⁺ n = (suc n , nonZero)

UIP-ℕ⁺ : UIP ℕ⁺
UIP-ℕ⁺ = UIP-Retract suc⁺ pred⁺  { (suc n , p)  refl }) UIP-ℕ