(* Factorial function *)
Definition e_fac : expr :=
r_fix (Lam
(e_if (isZ (Var 0))
(* base case *)
(Nat 1)
(* recursive case *)
(App (App (bin_primop mult) (Var 1))
(App (Var 2) (App (unary_primop Peano.pred) (Var 1)))))).

Lemma e_fac_typ :
Typ nil e_fac (ty_lam ty_nat ty_nat).