(* ** Multiplication *)
Arguments mult : simpl never.
Arguments plus : simpl never.
(* *** Addition *)
Definition Add_Step : pTM sigNat^+ (option unit) 2 :=
If (CaseNat @ [|Fin1|])
(Return (Constr_S @ [|Fin0|]) None)
(Return Nop (Some tt)).
Definition Add_Step_steps : nat := 9.
Definition Add_Step_size (a b : nat) : Vector.t (nat->nat) 2 :=
match b with
| 0 => [|id; id|]
| S b' => [|S; S|]
end.
Definition Add_Loop : pTM sigNat^+ unit 2 := While Add_Step.
Definition Add_Loop_steps b := 9 + 10 * b.
Fixpoint Add_Loop_size (a b : nat) : Vector.t (nat->nat) 2 :=
match b with
| O => Add_Step_size a b
| S b' => Add_Step_size a b >>> Add_Loop_size (S a) b'
end.

Lemma Add_Loop_SpecT_size (a b : nat) (ss : Vector.t nat 2) :
TripleT
(≃≃([],  withSpace ( [|Contains _ a; Contains _ b|]) ss))
(Add_Loop_steps b)
(Add_Loop)
(fun _ => tspec
([], withSpace [|Contains _ (a+b); Contains _ 0|]
(appSize (Add_Loop_size a b) ss))).