Section PaperExample.
(* Examples of the tactics that proof the correctness lemmata *)
Goal computable orb.
extractAs s.
computable_using_noProof s.
cstep.
cstep.
cstep.
all:    cstep.
Qed.
(* Print cnst. *)
(* Comming up with the conditions for the time bound *)
Goal forall fT, computableTime' orb fT.
intros.
extractAs s.
computable_using_noProof s.
cstep.
cstep. (* Note that the second goal got more specific *)
cstep. (* Note that the second goal got more specific *)
cstep.
1,2:cstep. (* Note that the hole in the second goal got filled with True*)
solverec.
Abort.
(* Finding the Time Bound *)
Goal computableTime' orb (fun _ _ => (cnst "c1",fun _ _ => (cnst "c2",tt))).
extract. solverec. (* Now the values are clear *)
Abort.
Goal computableTime' orb (fun _ _ => (1,fun _ _ => (3,tt))).
extract. solverec.
Abort.
Goal computable Nat.add.
unfold Nat.add.
extractAs s.
computable_using_noProof s.
cstep.
all:cstep.
all:cstep.
Qed.
Goal computable (fix f (x y z : nat) := y + match y with |  S (S y) => S (f x y z) | _ => 0 end).
extractAs s.
computable_using_noProof s.
cstep.
all:cstep.
all:cstep.
all:cstep.
Qed.
extractAs s.
computable_using_noProof s.
cstep.
cstep.
all:cstep.
all:cstep.
Qed.
extractAs s.
computable_using_noProof s.
repeat cstep.
Fail Guarded.
Abort.
intros f. assert (computable f) by (unfold f;extract).
extract.
Qed.
extract. (* not true*) Fail reflexivity.
Abort.
(* not a problem inside a function*)
Goal computable (fun n : nat => 10).
extract.
Qed.
Remove Hints term_map : typeclass_instances.
extractAs s.
computable_using_noProof s.
cstep.
cstep.
all:cstep.
Qed.
(*comming up with the condition *)
extractAs s.
computable_using_noProof s.
cstep.
cstep.
repeat cstep.
Abort.
(* comming up with the time bound *)
extract. solverec.
Abort.

Lemma term_map (X Y:Type) (Hx : registered X) (Hy:registered Y):
computableTime' (@map X Y)
(fun f fT => (1,fun l _ => (fold_right (fun x res => fst (fT x tt) + res + 12) 8 l,tt))).