{-# OPTIONS --cubical --no-exact-split --safe #-}
module Cubical.Data.Nat.Base where
open import Agda.Builtin.Nat public
using (zero; suc; _+_; _*_)
renaming (Nat to ℕ)
predℕ : ℕ → ℕ
predℕ zero = 0
predℕ (suc n) = n
caseNat : ∀ {ℓ} → {A : Set ℓ} → (a0 aS : A) → ℕ → A
caseNat a0 aS 0 = a0
caseNat a0 aS (suc n) = aS
doubleℕ : ℕ → ℕ
doubleℕ 0 = 0
doubleℕ (suc x) = suc (suc (doubleℕ x))
doublesℕ : ℕ → ℕ → ℕ
doublesℕ 0 m = m
doublesℕ (suc n) m = doublesℕ n (doubleℕ m)
iter : ∀ {ℓ} {A : Set ℓ} → ℕ → (A → A) → A → A
iter zero f z = z
iter (suc n) f z = f (iter n f z)