Section swap.
Hypothesis s1 s2:St.
Hypothesis Hneq12: s1<>s2.
Hypothesis Hneq01: s1 <> St0.
Hypothesis Hneq02: s2 <> St0.
Definition St_swap s :=
if St_eqb s1 s then s2 else
if St_eqb s2 s then s1 else s.
Definition Trans_swap(tr:Trans Σ) :=
let (s',d,o):=tr in
{| nxt:=St_swap s'; dir:=d; out:=o |}.
Definition option_Trans_swap(x:option (Trans Σ)) :=
match x with
| Some x0 => Some (Trans_swap x0)
| None => None
end.
Definition TM_swap(tm:TM Σ) :=
fun s i => option_Trans_swap (tm (St_swap s) i).
Definition ExecState_swap(st:ExecState Σ) :=
let (s,t):=st in
(St_swap s,t).

Lemma step_swap {tm st st0}:
step Σ (TM_swap tm) st = Some st0 <->
step Σ tm (ExecState_swap st) = Some (ExecState_swap st0).