Section Translate.
Variable (sig : finType).
Variable (sigX X : Type) (cX : codable sigX X).
Variable (I1 I2 : Retract sigX sig).
Definition translate : sig^+ -> sig^+ :=
fun t => match t with
| inl _ => t
| inr x => match Retr_g (Retract := I1) x with
| Some y => inr (Retr_f (Retract := I2) y)
| None => inl UNKNOWN
end
end.
Definition Translate' := MoveToSymbol (@isStop sig) translate.
Definition Translate'_Rel : pRel sig^+ unit 1 :=
ignoreParam (
fun tin tout =>
forall (x : X) (s : nat),
tin[@Fin0] ≃(I1; s) x ->
tout[@Fin0] ≂(I2; s) x
).
Definition Translate'_steps {sigX X : Type} {cX : codable sigX X} (x:X) := 8 + 4 *size x.
Definition Translate := Translate';; MoveLeft _.
Definition Translate_Rel : pRel sig^+ unit 1 :=
ignoreParam (
fun tin tout =>
forall (x : X) (s : nat),
tin[@Fin0] ≃(I1; s) x ->
tout[@Fin0] ≃(I2; s) x
).
Definition Translate_steps {sigX:Type} {cX : codable sigX X} (x : X) := 17 + 8 *size x.
Definition Translate_T : tRel sig^+ 1 :=
fun tin k => exists x, tin[@Fin0] ≃(I1) x /\ Translate_steps x <= k.

Lemma Translate_Terminates :
projT1 Translate ↓ Translate_T.