Decoding finite configurations in polynomial time #
Turing.MultiTapeTM.decodeFiniteCfg reads a finite configuration from any word, inverting
Turing.MultiTapeTM.encFiniteCfg, in polynomial time; a malformed word decodes to some
configuration. The fields are read off the frames of the encoding by unframe and dropFrame,
counts are clamped into range, and the cells of a stack tape are read by a finite transducer and
folded into a canonical tape by StackTape.cons, last cell first.
Main definitions #
Turing.MultiTapeTM.decodeStackTape,Turing.MultiTapeTM.decodeBiTape: decoders of tapes.Turing.MultiTapeTM.decodeTapes: the decoder of a fixed finite family of tapes.Turing.MultiTapeTM.decodeFiniteCfg: the decoder of finite configurations.
Main results #
Turing.MultiTapeTM.decodeFiniteCfg_encFiniteCfg: decoding inverts the encoding.Turing.MultiTapeTM.ComputableInPolyTime.decodeTapes: decoding a fixed finite family of tapes is polynomial-time.Turing.MultiTapeTM.ComputableInPolyTime.decodeFiniteCfg: decoding is polynomial-time.
Implementation notes #
Only unframe, dropFrame, list folds and finite transducers from the main development are
used. The cell transducer Turing.MultiTapeTM.cellsTransducer splits a framed list of cells, a
special case of splitting a word into its framed words; a general splitter with list decoders,
once available, could replace it, and Turing.MultiTapeTM.decodeState is a decoder of a finite
encoding from its length.
Cells #
The transducer emitting the bits of every framed cell. Its state is the summary of the framed word read so far, and whether a bit of that word is expected next.
Instances For
The transducer emits the bits of a framed cell and continues after its frame.
On an encoded list of cells, the transducer emits the bits of every cell.
Stack tapes #
Read the reversed bits of cells into a tape, last cell first: a symbol bit is held until the occupancy bit before it.
Instances For
Decode a stack tape from any word, inverting encStackTape encBool.
Instances For
The fold over the reversed bits of cells prepends the cells, last first.
Prepending the stored cells of a stack tape to the empty tape rebuilds it.
A word encoding a list of cells decodes to the tape of the cells, without the blank cells at its end.
Decoding inverts the encoding of stack tapes.
A step of Turing.MultiTapeTM.stackStep lengthens the encoded state by at most four bits.
Two-sided tapes and configurations #
Decoding inverts the encoding of cells.
Decode a two-sided tape from any word, inverting encBiTape encBool.
Instances For
Decoding inverts the encoding of two-sided tapes.
Decode a family of k tapes from any word, inverting encPi (encBiTape encBool).
Instances For
Decoding inverts the encoding of families of tapes.
Decoding inverts the encoding of control states.
Decoding in polynomial time #
Decoding a stack tape is polynomial-time.
Decoding a two-sided tape is polynomial-time.
Decoding a fixed finite family of tapes is polynomial-time.
Decoding a finite configuration is polynomial-time.