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 HaltTimeUpperBound_LE_swap_InitES tm:
HaltTimeUpperBound InitES (LE tm) -> HaltTimeUpperBound InitES (LE (TM_swap tm)).