Section Append.
Variable (sigX : finType) (X : Type) (cX : codable sigX X).
Hypothesis (defX: inhabitedC sigX).
Notation sigList := (FinType (EqType (sigList sigX))) (only parsing).
Let stop : sigList^+ -> bool :=
fun x => match x with
| inl (START) => true (* halt at the start symbol *)
| _ => false
end.
Definition App'_size {sigX X : Type} {cX : codable sigX X} (xs : list X) (s1 : nat) := s1 - (size (Encode_list cX) xs - 1).
Definition App'_Rel : Rel (tapes sigList^+ 2) (unit * tapes sigList^+ 2) :=
ignoreParam (fun tin tout =>
forall (xs ys : list X) (s0 s1 : nat),
tin[@Fin0] ≃(;s0) xs ->
tin[@Fin1] ≃(;s1) ys ->
tout[@Fin0] ≃(;s0) xs /\
tout[@Fin1] ≃(;App'_size xs s1) xs ++ ys).
Definition App' : pTM sigList^+ unit 2 :=
LiftTapes (MoveRight _;; Move Lmove;; Move Lmove) [|Fin0|];;
CopySymbols_L stop.
Definition App'_steps {sigX X : Type} {cX : codable sigX X} (xs : list X) :=
29 + 12 * size xs.
Definition App'_T : tRel sigList^+ 2 :=
fun tin k => exists (xs ys : list X), tin[@Fin0] ≃ xs /\ tin[@Fin1] ≃ ys /\ App'_steps xs <= k.

Lemma App'_Terminates : projT1 App' ↓ App'_T.