Section Fix.
Variable Σ : finType.
Variable retr_stack : Retract (sigList (sigPair sigHClos sigNat)) Σ.
Variable retr_heap : Retract sigHeap Σ.
Variable retr_clos : Retract sigHClos Σ.
Definition retr_pro : Retract sigPro Σ := ComposeRetract retr_clos _.
Definition retr_clos_stack : Retract sigHClos Σ := ComposeRetract retr_stack _.
Definition retr_stackEl : Retract (sigPair sigHClos sigNat) Σ :=
(ComposeRetract retr_stack _).
Definition retr_nat_stack : Retract sigNat Σ :=
ComposeRetract retr_stackEl
(Retract_sigPair_Y _ _) .
Local Notation n := 10 (only parsing).
Local Notation i_io := Fin0 (only parsing).
Local Notation i_H := Fin1 (only parsing).
Definition M : pTM (Σ) ^+ unit n:=
Translate retr_clos retr_clos_stack @[|i_io|];;
CasePair _ _ ⇑ retr_clos_stack @ [|i_io;Fin2|];;
WriteValue ( 1) ⇑ Private_UnfoldClos.retr_nat_clos_var retr_stack @ [|Fin3|];;
Private_UnfoldClos.M retr_stack retr_heap @ [|i_H;Fin2;i_io;Fin3;Fin4;Fin5;Fin6;Fin7;Fin8;Fin9|];;
Translate (Private_UnfoldClos.retr_pro retr_stack) retr_pro @ [|Fin5|];;
WriteValue ( [retT]) ⇑ retr_pro @ [|i_io|];;
Rev_Append _ ⇑ retr_pro @ [| Fin5;i_io;Fin6 |];;
Cons_constant.M lamT ⇑ retr_pro @ [| i_io|].
Definition steps H '(a',P) t' :=
match t' with lam t' =>
match decompile 0 P [] with
inl [s'] =>
1 + Translate_steps (a', compile s') +
(1 + CasePair_steps (fst (a', compile s')) +
(1 + WriteValue_steps (size 1) +
(1 + Private_UnfoldClos.steps H a' 1 s' t' +
(1 + Translate_steps (rev (compile t')) +
(1 + WriteValue_steps (size [retT]) +
(1 + Rev_Append_steps Encode_Com (rev (compile t')) +
Cons_constant.time lamT))))))
| _ => 0
end
| _ => 0 end.

Lemma SpecT (H:Heap) g s:
reprC H g s ->
TripleT
≃≃([]
,[|Contains retr_clos g;Contains retr_heap H;Void;Void;Void;Void;Void;Void;Void;Void|])
(steps H g s) M
(fun r => ≃≃([]
,[|Contains retr_pro (compile s);Contains retr_heap H;Void;Void;Void;Void;Void;Void;Void;Void|])).