Structured RAM terminated-unary cursor decoder — definitions #
This reusable parser consumes the first terminated-unary field of an input bit array. It is the first nested-control component of the RAM circuit evaluator: the loop can exit either successfully at a zero terminator or unsuccessfully at the end of the available array.
Success verdict: one exactly when a zero terminator was consumed.
Instances For
Decoded unary value.
Equations
Instances For
Address of the next unconsumed input bit.
Instances For
Number of unconsumed input bits.
Instances For
Constant-one register.
Equations
Instances For
Current input bit.
Equations
Instances For
Loop activity flag.
Equations
Instances For
First register occupied by input bits.
Equations
Instances For
Reserved-register input store for one unary field and its suffix.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Initialize the parser cursor, accumulator, constant, and activity flag.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Parser initialization.
Equations
Instances For
Record an unterminated field after exhausting the available input.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Record a successfully consumed zero terminator.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Consume one available bit and either stop or increment the unary value.
Equations
- One or more equations did not get rendered due to their size.
Instances For
One parser iteration, including the exhausted-input case.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Iterate until the parser records success or truncation.
Equations
Instances For
Semantic calling convention for invoking mainLoop at an existing cursor.
The already-consumed prefix is represented by offset; value is the current
field's unary accumulator, and remaining is the still-readable suffix.
Registers at or above inputBase are data rather than parser scratch, so the
loop's routine theorem can frame them unchanged.
Consumed and remaining bits account for the original input.
The current field accumulator cannot exceed the absolute cursor offset.
No successful terminator has been recorded yet.
The accumulator contains the current field's consumed one-bits.
The cursor points to the first remaining bit.
The remaining-length register agrees with the semantic suffix.
The parser's constant-one register is initialized.
The loop is active.
- input_eq (delta : ℕ) : store (inputBase + offset + delta) = match remaining[delta]? with | some bit => Input.bitValue bit | none => 0
Physical input registers encode the remaining semantic suffix.
Instances For
Complete terminated-unary decoder.
Equations
Instances For
Concrete compiled RAM decoder.
Equations
Instances For
Exact compiled transition count through the first terminator or exhaustion.
Equations
Instances For
Explicit logarithmic-time budget.
Equations
- Complexity.RAM.Structured.UnaryDecode.timeBound inputLength = 96 * (inputLength + 1) * (Complexity.RAM.bitlen (inputLength + Complexity.RAM.Structured.UnaryDecode.inputBase) + 1)
Instances For
Explicit peak-space budget.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Shifted quasilinear comparison function.
Equations
- One or more equations did not get rendered due to their size.