module DataStructures where
open import Naturals
open import Addition
open import Finite
open import LogicalFacts
data List (X : Set) : Set where
[] : List X
_::_ : X → List X → List X
infixr 30 _::_
list : {m : ℕ} {X : Set} → (smaller m → X) → List X
list {0} s = []
list {succ m} s = s fzero :: list {m} (s ∘ fsucc)
data _×_ (X Y : Set) : Set where
_,_ : X → Y → X × Y
infixr 20 _,_
open import Cantor
open import Two
_^_ : ℕ → ₂ℕ → ₂ℕ
(0 ^ α) 0 = ₀
((succ n) ^ α) 0 = ₁
(b ^ α) (succ n) = α n
infixr 30 _^_
take : (m : ℕ) {X : Set} → (ℕ → X) → List X
take 0 α = []
take (succ m) α = α 0 :: take m (α ∘ succ)
_!_ : {m : ℕ} → (smaller(m + 1) → ℕ) → ℕ → ℕ
_!_ {m} s n = s(fmin m n)