type nat = Z | S of nat

let rec to_int n =
    match n with
      Z -> 0
    | S p -> 1 + to_int p

let one = S(Z)

let five = S(S(S(S(S(Z)))))
 
let six = S(S(S(S(S(S(Z))))))

let succ n = S n

let pred n =
  match n with
    Z -> Z
  | S p -> p


    
let rec add m n = 
    match m with 
    Z -> n
  | S p -> add p (S n)

let rec mul m n =
    match m with 
    Z -> Z
  | S p -> add n (mul p n)
	
let _ = to_int (mul five six)



