module Zoo3eg

id : (A : _) -> A -> A
id = \ A x => x

List : U -> U
List = \ A => (L : _) -> (A -> L -> L) -> L -> L

nil : (A : _) -> List A
nil = \ A L cons nil => nil

cons : (A : _) -> A -> List A -> List A
cons = \A x xs L cons nil => cons x (xs _ cons nil)

Bool : U
Bool = (B : _) -> B -> B -> B

true : Bool
true = \ B t f => t

false : Bool
false = \ B t f => f

not : Bool -> Bool
not = \ b B t f => b B f t

Eq : (A : _) -> A -> A -> U
Eq = \A x y => (P : A -> U) -> P x -> P y

refl : (A : _) (x : A) -> Eq A x x
refl = \ A x p px => px

list1 : List Bool
list1 = cons _ true (cons _ false (nil _))

Nat : U
Nat = (N : U) -> (N -> N) -> N -> N

five : Nat
five = \ N s z => s (s (s (s (s z))))

add : Nat -> Nat -> Nat
add = \ a b N s z => a N s (b N s z)

mul : Nat -> Nat -> Nat
mul = \a b N s z => a N (b N s) z

ten : Nat
ten = add five five

hundred : Nat
hundred = mul ten ten

thousand : Nat
thousand = mul ten hundred

eqTest : Eq _ hundred hundred
eqTest = refl _ _
