Section Fix.
Variable Σ : finType.
Variable s b : Σ^+.
Variable (retr_list : Retract (sigList bool) Σ).
Local Instance retr_bool : Retract bool Σ := ComposeRetract retr_list (Retract_sigList_X _).
Definition M__step : pTM (Σ) ^+ (option unit) 3 :=
If (CaseList _ ⇑ retr_list @ [|Fin0;Fin2|])
(Switch (CaseBool ⇑ retr_bool @ [|Fin2|])
(fun x =>
WriteMove (if x then s else b) Lmove @ [|Fin1|];;
Return Nop None))
(Reset _ @[|Fin0|];;Return (Write b @ [|Fin1|]) (Some tt)).
Definition M__loop := While M__step.

Lemma loop_SpecT:
{ f : UpToC (fun bs => length bs + 1) &
forall bs res,
TripleT
(≃≃([]%list,[|Contains _ bs; Custom (fun t => right t = map (fun (x:bool) => if x then s else b) res
/\ length (left t) <= length bs); Void|]) )
(f bs)
M__loop
(fun _ => ≃≃([]%list,[|Void; Custom (eq (encBoolsTM s b (rev bs++res))) ; Void  |])) }.