Ternary registers for binary work tapes #
A normalized StackTape Bool is a base-three natural number, with the cell nearest the head
as its least significant digit. Blank is zero, false is one, and true is two. Normalization
of the stored tail is essential: appending a blank at the far end does not change the code.
The arithmetic push, pop and observation operations below agree with StackTape operations.
Main definitions #
Turing.MultiTapeNTM.ConfigurationGraph.symbolCode: ternary code for a cell.Turing.MultiTapeNTM.ConfigurationGraph.stackCode: ternary code for a normalized stack.
Main results #
Turing.MultiTapeNTM.ConfigurationGraph.stackCode_cons: push is multiplication by three.Turing.MultiTapeNTM.ConfigurationGraph.stackCode_head: observation is remainder by three.Turing.MultiTapeNTM.ConfigurationGraph.stackCode_tail: pop is division by three.Turing.MultiTapeNTM.ConfigurationGraph.stackCode_lt: the code fits exponentially in length.
References #
Uses Bolton Bailey's normalized StackTape and BiTape APIs.
Blank, false and true are the ternary digits zero, one and two.
Instances For
The ternary code of a normalized stack.
Instances For
The normalizing push still has the usual base-three arithmetic meaning.
The digit under the stack head is its least significant ternary digit.
Removing the head divides the stack register by three.
The registers of a bidirectional tape, in head/left/right order.