Machines as transformers of tape words #
The interface through which combinators use machines: a machine reads words from its work tapes and leaves words on them. A combinator composing such machines talks about words only, never about individual cells, head positions or the set of tapes a machine has touched.
Configurations are described by equalities: wordsCfg input q ws out is the configuration whose
work tape i holds exactly the word ws i (contents tapeOfList (ws i), head at the start), with
the input head at the start of the input and output out. A specification
TransformsTapes tm P Q t s says: started on word-holding tapes satisfying P, after exactly t
steps the machine sits in the halted normal form wordsCfg input none ws' out (every head reset
to its initial position, tapes blank outside their words, output untouched), with the new words
related to the old ones by Q and using at most s work-tape cells. The machine may halt earlier
than t; since a halted machine stays put and stops visiting new cells, running on to t costs
nothing, so a fixed step count loses no generality and spares every composition an existential.
Requiring this normal form is what lets specifications compose by rewriting: the halting
configuration of one machine is already a valid start for the next, so which words survived a step
is read off the equation, not re-established cell by cell.
Main definitions #
Turing.MultiTapeTM.tapeOfList: the tape holding exactly a given word.Turing.MultiTapeTM.wordsCfg: the configuration whose tapes hold given words.Turing.MultiTapeTM.TransformsTapes: the specification format described above.Turing.MultiTapeTM.nop: the machine that does nothing.
Main results #
Turing.MultiTapeTM.TransformsTapes.imp: strengthen the precondition, weaken the postcondition and raise the bounds.Turing.MultiTapeTM.transformsTapes_nop:nopleaves every word as it was, the first machine of the interface and the check that the format is inhabited as intended.
A tape containing exactly the symbols of xs at positions 0, ..., xs.length - 1.
Equations
- Turing.MultiTapeTM.tapeOfList xs (Int.ofNat n) = xs[n]?
- Turing.MultiTapeTM.tapeOfList xs (Int.negSucc a) = none
Instances For
Appending one symbol writes precisely the cell after the existing word.
The blank tape holds the empty word.
The cell at position 0 holds the first symbol of the word.
The configuration whose work tape i holds exactly the word ws i with its head at the
start, whose input head is at the start of the input, in state q with output out.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Remapping the state of a wordsCfg remaps its state and leaves the words alone.
The initial configuration is the word configuration with blank tapes and no output.
TransformsTapes tm P Q t s: started in its initial state on tapes holding words ws that
satisfy the precondition P, the machine is halted after exactly t steps in the configuration
whose tapes hold words ws' with Q input ws ws', having used at most s work-tape cells. The
machine is free to halt before step t, because it then stays in that configuration.
The bounds are numbers; a specification whose bounds depend on the data is a family
∀ j, TransformsTapes tm (P j) (Q j) (t j) (s j) over one fixed machine.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A TransformsTapes statement can be read with a stronger precondition, a weaker postcondition
and larger bounds.
The machine that does nothing: it halts on its first step, leaving the configuration unchanged.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The machine that does nothing halts in one step, leaving every word as it was. Its heads never move, so it visits one cell per tape. This is the first machine of the interface: it checks that the specification format is inhabited exactly as intended.