Section StateWhile_TerminatesIn.
Variable (T T' : F1 -> tRel sig n).

Lemma StateWhile_TerminatesIn_ind l :
(forall l, pM l ⊨ R l) ->
(forall l, projT1 (pM l) ↓ T' l) ->
(forall l (tin : tapes sig n) (k : nat),
T l tin k ->
exists k1,
T' l tin k1 /\
(forall tmid l2, R l tin (inr l2, tmid) -> k1 <= k) /\
(forall tmid l1, R l tin (inl l1, tmid) -> exists k2, T l1 tmid k2 /\ 1 + k1 + k2 <= k)) ->
StateWhileTM l ↓ T l.