Native decoding of flat constructor streams #
RecursiveEncoding.readNode interprets each constructor token by its arity and constructor.
When constructing a node writes that token followed by its children's streams, the generic
prefix parser accepts exactly the complete one-root forests. Its successful output has exactly
the original token stream as its encoding. Consequently decoding typed tokens has a native
polynomial-time certificate whenever token arities can be read in polynomial time and have a
fixed bound. This does not supply a decoder for arbitrary bit-word embeddings of scalar fields.
Interpret a constructor token using its recursive arity and constructor function.
Every successful node parse produces a complete tree prefix and preserves its suffix.
A complete node stream is parsed with fuel at least its token count, preserving every following token. No semantic inhabitant or field decoder is required.
Decoding succeeds exactly on complete node streams, and re-encoding its value recovers every input token. Missing operands and trailing input are rejected.
Typed constructor-stream decoding has a native polynomial-time certificate. Its machine validates the stream and emits its original encoded word; it need not build semantic Lean values. The token embedding supplies no decoder for arbitrary bit words.