Named native streaming codecs #
This module retains the actual finite-state transducers used by the first layer of an encoded
universal interpreter. NativeCompiler.ofTransducer packages the transducer followed by the
existing input rewind, with its constructive state encoding, exact description, linear clock and
zero workspace. It does not select a machine from an existential computability certificate.
The named codecs are total on malformed words. In particular, the Boolean decoder uses false on
empty input, frame decoders follow the existing incomplete-frame convention, and framesDecoder
closes a final incomplete frame. Pair projections reuse those same machines directly rather than
treating encoded tuple access as a semantic callback.
Main definitions #
Turing.MultiTapeTM.Internal.NativeCompiler.ofTransducer: retain a finite transducer as a named tidy compiler.Turing.MultiTapeTM.Internal.NativeCompiler.prefixBit: retain a raw-word prefix operation.Turing.MultiTapeTM.Internal.NativeCompiler.optionSome,.sumInl,.sumInr: retain the direct one-bit prefix transducers for standard option and sum encodings.Turing.MultiTapeTM.Internal.NativeCompiler.optionIsSomeBool,.optionIsSomeTest: retain the standard option-constructor test in Boolean and branch-test encodings.Turing.MultiTapeTM.Internal.NativeCompiler.sumTag,.sumPayload: retain the constructor tag and untagged payload word.Turing.MultiTapeTM.Internal.NativeCompiler.framedValue: retain standard framing while keeping the semantic value type.Turing.MultiTapeTM.Internal.NativeCompiler.first,Turing.MultiTapeTM.Internal.NativeCompiler.second: direct standard-pair projections.Turing.MultiTapeTM.Internal.NativeCompiler.unaryDecoder,Turing.MultiTapeTM.Internal.NativeCompiler.boolDecoder: total unary and Boolean decoders.Turing.MultiTapeTM.Internal.NativeCompiler.isEmpty,.boolToTest,.unaryIsZero,.unaryIsZeroTest,.unaryPred: retained empty-word testing, the explicit Boolean-to-branch tag conversion, unary zero testing and saturating unary predecessor.Turing.MultiTapeTM.Internal.NativeCompiler.unframeDecoder,Turing.MultiTapeTM.Internal.NativeCompiler.unframeValue,Turing.MultiTapeTM.Internal.NativeCompiler.dropFrameDecoder,Turing.MultiTapeTM.Internal.NativeCompiler.framesDecoder: named total frame parsers.Turing.MultiTapeTM.Internal.NativeCompiler.unaryListDecoder: split a raw word into frames and replace every frame by its unary length in one streaming pass.Turing.MultiTapeTM.Internal.NativeCompiler.takeUnary,.dropUnary: retain the direct linear encoded-list prefix and suffix machines through the existing tidy normal form.
Retain a finite transducer followed by input rewind as a named tidy compiler. Every input bit is read by the transducer and by the rewind; emitted bits are included in the transducer clock.
Prefix a fixed tag bit, streaming the input unchanged after the first transition.
The prefix transducer emits exactly the fixed tag followed by the input.
Retained raw-word prefix operation.
Retained constructor for the standard some tag.
Retained standard framing with the semantic value type unchanged.
Drop the first bit of a raw word.
Total Boolean decoder, returning false on empty input and the first symbol otherwise.
Explicit encoding of the three frame-parser states.
Explicit encoding of the three list-frame-parser states.
Explicit encoding of the direct unary take/drop kernel's eight control states.
Explicit encoding of the four control states used to clear a work tape and its shadow.
Constructive encoding of the recursively nested control used to clear a list of work tapes.
Decode a framed list of words to their unary lengths in one streaming pass. This uses the
same total convention as frames: a final incomplete frame is closed.
While inside a frame, unaryListT emits the unary length of that frame and continues with
the remaining framed word.
The streaming decoder emits the standard encoded list of all decoded unary lengths.
Total unary decoder: every input symbol contributes one unary output symbol.
Read the standard option constructor tag with one-bit Boolean output.
Test whether a raw word is empty. The machine scans the whole input, emits the standard Boolean encoding and rewinds; malformedness is irrelevant because every raw word is accepted.
Convert the one-bit Boolean encoding to the branch-test encoding: false becomes the empty
word and true becomes [true]. Branching consumers must charge this retained conversion rather
than interpreting encBool as encTest.
The true-filter transducer realizes the empty/nonempty test encoding on one-bit Booleans.
Retained conversion from one-bit Booleans to empty/nonempty branch tests.
Read the standard option constructor tag in the empty/nonempty branch encoding.
Test whether a unary natural is zero using the same retained empty-word transducer.
Unary zero test in the empty/nonempty branch encoding, including the retained tag conversion.
Saturating predecessor on unary naturals. This is the public headT drop-first-symbol
machine, not the private proof-local predecessor transducer from the degree calculus.
Total first-frame decoder, including the existing incomplete-frame behavior.
Remove the frame around a typed encoded value. This retains the same parser as
unframeDecoder, with no semantic decoding step.
Total decoder for the word following the first frame.
Split a raw word into framed words, closing a final incomplete frame.
Decode every framed word to its unary length. A final incomplete frame is closed exactly as
by frames; no semantic list-map callback is hidden behind this compiler.