Module Translation.
Definition to_St(x:Q):St :=
match x with
| BB52.A => St0
| BB52.B => St1
| BB52.C => St2
| BB52.D => St3
| BB52.E => St4
end.
Definition of_St(x:St):Q :=
match x with
| St0 => BB52.A
| St1 => BB52.B
| St2 => BB52.C
| St3 => BB52.D
| St4 => BB52.E
end.
Definition to_Σ(x:Sym):Σ :=
match x with
| BB52.S0 => Σ0
| BB52.S1 => Σ1
end.
Definition of_Σ(x:Σ):Sym :=
match x with
| Σ0 => BB52.S0
| Σ1 => BB52.S1
end.
Definition to_Dir(x:TM.dir):Dir :=
match x with
| TM.L => Dneg
| TM.R => Dpos
end.
Definition to_halftape(x:side):nat->Σ :=
fun n => to_Σ (Streams.Str_nth n x).
Definition to_tape(x:tape):BinInt.Z->Σ :=
let '(l0,m0,r0):=x in
make_tape (to_halftape l0) (to_Σ m0) (to_halftape r0).
Definition to_ExecState(x:Q*tape):ExecState Σ :=
let (s0,t0):=x in
(to_St s0,to_tape t0).
Definition to_oTrans(x:option (Sym*TM.dir*Q)):option (Trans Σ) :=
match x with
| None => None
| Some (o,d,s) => Some {| nxt:=to_St s; dir:=to_Dir d; out:=to_Σ o |}
end.
Definition to_TM(tm:TM):BB52Statement.TM Σ :=
fun s0 i0 =>
to_oTrans (tm (of_St s0,of_Σ i0)).
Ltac translate_nonhalt x2 x3 :=
match goal with
| |- ~HaltsFromInit Σ Σ0 ?x1 =>
replace x1 with (to_TM x2);
[ apply to_NonHalt,x3
| fext; fext;
match goal with
| x:St, x0:Σ |- _ => destruct x,x0; reflexivity
end ]
end.
End Translation.
Definition tm_holdouts_13 :=
Finned1::Finned2::Finned3::Finned4::Finned5::
Skelet1::Skelet10::Skelet15::Skelet17::Skelet26::Skelet33::Skelet34::Skelet35::
nil.
Definition Trans_eqb(tr1 tr2:Trans Σ):bool :=
let (s1,d1,o1):=tr1 in
let (s2,d2,o2):=tr2 in
St_eqb s1 s2 &&&
Dir_eqb d1 d2 &&&
Σ_eqb o1 o2.
Ltac Trans_eq_dec s1 s2 := eq_dec Trans_eqb_spec Trans_eqb s1 s2.
Definition option_eqb {T}(f:T->T->bool) (t1 t2:option T):bool :=
match t1,t2 with
| Some c1,Some c2 => f c1 c2
| None,None => true
| _,_ => false
end.

Lemma option_eqb_spec {T}(f:T->T->bool)(f_spec:forall t1 t2, if f t1 t2 then t1=t2 else t1<>t2) a1 a2:
if option_eqb f a1 a2 then a1=a2 else a1<>a2.