type 'a nat = ('a -> 'a) -> 'a -> 'a
(* Unused type definition for clarity *)

let zero f x = x

let succ n f x = f (n f x)

let to_int n = n (fun i -> i+1) 0

let five = succ(succ(succ(succ(succ(zero)))))
 
let six = succ(succ(succ(succ(succ(succ(zero))))))

let add m n f x = m f (n f x)  
(* add = fun m -> fun f -> ... is just as good *)

let mul m n f x = m (n f) x

let _ = to_int (mul five six)




