BiTape: Bidirectionally infinite TM tape representation using StackTape #
This file defines BiTape, a tape representation for Turing machines
in the form of an List of Option values,
with the additional property that the list cannot end with none.
Design #
Note that Mathlib has a Tape type, but it requires the alphabet type to be inhabited,
and considers the ends of the tape to be filled with default values.
This design requires the tape elements to be Option values, and ensures that
Lists of the base alphabet, rendered directly onto the tape by mapping over some,
will not collide.
Main definitions #
BiTape: A tape with a head symbol and left/right contents stored asStackTapeBiTape.move: Move the tape head left or rightBiTape.write: Write a symbol at the current head positionBiTape.spaceUsed: The space used by the tape
Move the head left by shifting the left StackTape under the head.
Instances For
Move the head right by shifting the right StackTape under the head.
Instances For
Move the head to the left or right, shifting the tape underneath it.
Instances For
Optionally perform a move, or do nothing if none.