Section MoveToStart.
Definition MoveToStart_Rel : pRel sigSim unit 1 :=
ignoreParam
(fun tin tout =>
forall tps, atNil tin[@Fin0] tps ->
atStart tout[@Fin0] tps).
Definition isStart : sigSim -> bool :=
fun s => match s with
| inl START => true
| _ => false
end.
Definition MoveToStart : pTM sigSim unit 1 :=
MoveToSymbol_L isStart id.
(* Definition tape_size (tp : tape sig) : nat := match tp with | niltape _ => 1 | rightof l ls => 3 + length ls | leftof r rs => 3 + length rs | midtape ls m rs => 3 + length ls + length rs end.  Fixpoint tapes_size (tps : list (tape sig)) : nat := match tps with | nil => 1 | tp :: tps' => 1 + tape_size tp + tapes_size tps' end.  Lemma tape_size_length (tp : tape sig) : tape_size tp = length (encode_tape tp). *)
Definition MoveToStart_steps (tps : list (tape sig)) :=
8 + 4 * length (encode_list _ tps).
Definition MoveToStart_T : tRel sigSim 1 :=
fun tin k => exists tps, atNil tin[@Fin0] tps /\ MoveToStart_steps tps <= k.

Lemma atStart_contains (t : tape sigSim) (tps : list (tape sig)) (T : tapes sig n) :
length tps = n ->
atStart t tps ->
vector_to_list T = tps ->
t ≃ T.