Section TM.
Hypothesis Σ:Set.
Hypothesis Σ0:Σ.
Definition HaltsAt(tm:TM Σ)(n:nat)(st:ExecState Σ): Prop :=
exists st', Steps Σ tm n st st' /\ step Σ tm st' = None.
Definition Halts(tm:TM Σ)(st:ExecState Σ): Prop :=
exists n, HaltsAt tm n st.
Definition HaltsFromInit(tm:TM Σ): Prop :=
Halts tm (InitES Σ Σ0).
Definition NonHalt tm st :=
forall n, exists st', Steps Σ tm n st st'.
Definition LE(tm tm':TM Σ): Prop :=
forall (s:St)(i:Σ),
tm s i = tm' s i \/
tm s i = None.
Hypothesis BB:nat.
Definition HaltTimeUpperBound(st:ExecState Σ)(P:TM Σ->Prop):Prop :=
forall (tm:TM Σ)(n0:nat), P tm -> HaltsAt tm n0 st -> n0<=BB.
Hypothesis Σ_eqb:Σ->Σ->bool.
Hypothesis Σ_eqb_spec: forall i1 i2, if Σ_eqb i1 i2 then i1=i2 else i1<>i2.
Definition TM_upd tm s i t: TM Σ :=
fun s0 i0 =>
if (andb (St_eqb s0 s) (Σ_eqb i0 i)) then t else tm s0 i0.

Lemma LE_HaltsAtES_1 {tm tm0 n st s t}:
LE tm tm0 ->
HaltsAt tm n st ->
Steps Σ tm n st (s,t) ->
tm0 s (t 0%Z) = None ->
HaltsAt tm0 n st.