Section CaseBool.
Local Notation sig := bool.
Definition CaseBool : pTM bool^+ bool 1 :=
Move Rmove;;
Switch (ReadChar)
(fun s => match s with
| Some (inr x) => Return (Move Rmove) x
| _ => Return (Nop) default
end).
Definition CaseBool_Rel : pRel bool^+ bool 1 :=
fun tin '(yout, tout) => forall (x : sig) (s : nat), tin[@Fin0] ≃(;s) x -> isVoid_size tout[@Fin0] (S(S(s))) /\ yout = x.
Definition CaseBool_steps := 5.
(* There is no need for a constructor, just use [WriteValue] *)
End CaseBool.
Arguments CaseBool : simpl never.
Ltac smpl_TM_CaseBool :=
once lazymatch goal with
| [ |- CaseBool ⊨ _ ] => eapply RealiseIn_Realise; apply CaseBool_Sem
| [ |- CaseBool ⊨c(_) _ ] => apply CaseBool_Sem
| [ |- projT1 CaseBool ↓ _ ] => eapply RealiseIn_TerminatesIn; apply CaseBool_Sem
end.
Smpl Add smpl_TM_CaseBool : TM_Correct.
Definition CaseBool_size (_ : bool) : Vector.t (nat->nat) 1 :=
[|plus 2|].

Lemma CaseBool_SpecT_size (b : bool) (ss : Vector.t nat 1) :
TripleT
(≃≃(([], withSpace  [|Contains _ b |] ss)))
CaseBool_steps
CaseBool
(fun yout =>
≃≃([yout = b], withSpace ([|Void|]) (appSize (CaseBool_size b) ss))).