(*   Usage:                                             *)
(*     Import NatTrec.                                  *)
(*        in section definining functions, rebinds all  *)
(*        non-tail recursive operators.                 *)
(*     rewrite !trecE.                                  *)
(*        in the correctness proof, restores operators  *)

Fixpoint add m n := if m is m'.+1 then m' + n.+1 else n
where "n + m" := (add n m) : nat_scope.(*   Usage:                                             *)
(*     Import NatTrec.                                  *)
(*        in section definining functions, rebinds all  *)
(*        non-tail recursive operators.                 *)
(*     rewrite !trecE.                                  *)
(*        in the correctness proof, restores operators  *)

Fixpoint add m n := if m is m'.+1 then m' + n.+1 else n
where "n + m" := (add n m) : nat_scope.Fixpoint add_mul m n s := if m is m'.+1 then add_mul m' n (n + s) else s.Definition mul m n := if m is m'.+1 then add_mul m' n n else 0.Fixpoint mul_exp m n p := if n is n'.+1 then mul_exp m n' (m * p) else p.Definition exp m n := if n is n'.+1 then mul_exp m n' m else 1.Local Notation oddn := odd.Fixpoint odd n := if n is n'.+2 then odd n' else eqn n 1.Local Notation doublen := double.Definition double n := if n is n'.+1 then n' + n.+1 else 0.

Lemma oddE : odd =1 oddn.