(* * Constructors and Deconstructors for Comens *)
From Undecidability.TM.L Require Import Alphabets.
Definition CaseCom : pTM sigCom^+ (option ACom) 1 :=
If (CaseSum _ _)
(Return Nop None)
(Relabel (ChangeAlphabet (CaseFin (FinType(EqType(ACom))) ) _) Some).
Definition CaseCom_size (t : Tok) : nat -> nat :=
match t with
| varT n => S
| _ => S >> S >> S
end.
Definition CaseCom_Rel : pRel sigCom^+ (FinType (EqType (option ACom))) 1 :=
fun tin '(yout, tout) =>
forall (t : Tok) (s : nat),
tin[@Fin0] ≃(;s) t ->
match yout with
| Some c =>
isVoid_size tout[@Fin0] (CaseCom_size t s) /\ ACom2Com c = t
| None => exists n, t = varT n /\ tout[@Fin0] ≃(;CaseCom_size t s) n
end.
Definition CaseCom_steps := 11.

Lemma CaseCom_Sem : CaseCom ⊨c(CaseCom_steps) CaseCom_Rel.