(** * Skelet #26 *)
Set Default Goal Selector "!".
Definition tm : TM := fun '(q, s) =>
match q, s with
| A, 0 => Some (1, R, B)  | A, 1 => Some (1, L, D)
| B, 0 => Some (1, R, C)  | B, 1 => Some (0, R, B)
| C, 0 => Some (1, L, A)  | C, 1 => Some (1, R, C)
| D, 0 => Some (1, L, E)  | D, 1 => Some (0, L, A)
| E, 0 => Some (1, L, C)  | E, 1 => None
end.
Notation "c --> c'" := (c -[ tm ]-> c')   (at level 40).
Notation "c -->* c'" := (c -[ tm ]->* c') (at level 40).
Notation "c -->+ c'" := (c -[ tm ]->+ c') (at level 40).
Notation P := Pos.succ.
Definition D n a m : Q * tape :=
L n <{{D}} 1 >> 0 >> 1 >> a >> R m.

Lemma R_inc_has0 : forall n l,
has0 n ->
l {{C}}> R n -->* l <{{D}} R (P n).