Section WriteValue.
Variable (sig: finType) (X: Type) (cX: codable sig X).
Definition WriteValue (x : X) : pTM sig^+ unit 1 :=
WriteString Lmove (rev (inl START :: map inr (encode x) ++ [inl STOP])).
Definition WriteValue_size (sig:Type) (cX: codable sig X) (x : X) (s : nat) : nat := s - (S (size x)).
Definition WriteValue_Rel (x:X) : Rel (tapes sig^+ 1) (unit * tapes sig^+ 1) :=
fun tin '(_, tout) =>
forall (s0:nat),
isVoid_size tin[@Fin0] s0 ->
tout[@Fin0] ≃(;WriteValue_size cX x s0) x.
Definition WriteValue_steps (l : nat) := 3 + 2 * l.

Lemma WriteValue_Sem (x:X) :
WriteValue x ⊨c(WriteValue_steps (length (encode x))) WriteValue_Rel x.