Zip transducers and their machine semantics #
A zip transducer reads two binary words in lockstep, least significant digit first, padding the
shorter one with none. Its machine ZipTransducer.toTM reads frame u ++ v from the input
tape: it copies u to its single work tape, rewinds that tape and then reads v on the input
tape and u on the work tape simultaneously. It runs in time linear in the input and uses
u.length + 2 work-tape cells.
Main definitions #
Turing.MultiTapeTM.ZipTransducer: finite-state transducers on pairs of optional bits.Turing.MultiTapeTM.ZipTransducer.run: the word a zip transducer emits on two words.Turing.MultiTapeTM.ZipTransducer.toTM: the zip transducer as a machine with one work tape.
Main results #
Turing.MultiTapeTM.ZipTransducer.computesInTimeAndSpace_toTM: onframe u ++ v,τ.toTMemitsτ.run τ.q₀ u vwithin3 * (frame u ++ v).length + 1steps andu.length + 2cells.
A finite-state transducer reading two words in lockstep. In state q, on the pair (x, y) of
the next digits of the two words, where none pads the shorter word, it moves to
(step q (x, y)).1 and emits (step q (x, y)).2; when both words are exhausted it emits
final q. The value of step on (none, none) is never used.
- q₀ : Q
The initial state.
The successor state and the emitted word on reading a pair of digits.
The word emitted when both words are exhausted.
At most two symbols are emitted per pair of digits.
At most two symbols are emitted at the end.
Instances For
The word τ emits on the words u and v, started in state q.
Instances For
The control states of ZipTransducer.toTM.
- copy {Q : Type u_2} : State Q
Expecting the next frame marker of the first word.
- copyBit {Q : Type u_2} : State Q
Expecting the next digit of the first word, to be copied to the work tape.
- rewind {Q : Type u_2} : State Q
Moving the work head back to the start of the copied word.
- zip {Q : Type u_2} (q : Q) (pending : Option Bool) : State Q
Running
τin stateq, with a pending output symbol. - flush {Q : Type u_2} (b : Bool) : State Q
Emitting the last output symbol before halting.
Instances For
τ as a machine with one work tape. On frame u ++ v it copies u to the work tape,
rewinds the work tape, and then runs τ on u from the work tape and v from the input tape.
Instances For
Configurations #
Runs through a set of work-head positions #
The framed input #
The phases of the machine #
The transitions used outside the copy phase, for arbitrary read symbols.
On frame u ++ v, τ.toTM emits τ.run τ.q₀ u v within 3 * (frame u ++ v).length + 1
steps, visiting the u.length + 2 work-tape cells -1, …, u.length.