(* * Pointer bookkeeping for machines using (positive) binary numbers *)
Local Open Scope positive_scope.
Definition atBit (t : tape sigPos^+) (lp : positive) (mb : bool) (rs : list bool) :=
exists (ls : list sigPos^+),
t = midtape (map inr (rev (encode lp)) ++ inl START :: ls) (bitToSigPos' mb) (map bitToSigPos' rs ++ [inl STOP]).
Definition atLSB (t : tape sigPos^+) (lp : positive) (mb : bool) := atBit t lp mb nil.

Lemma atBit_moveRight (t : tape sigPos^+) (lp : positive) (b : bool) (rs : list bool) :
atBit t lp b rs ->
match rs with
| nil => tape_move t Rmove ≂ lp ~~ b
| b' :: rs' => atBit (tape_move t Rmove) (lp ~~ b) b' rs'
end.