Documentation

Complexitylib.Models.RandomAccessMachine.Structured.UnaryDecode.Defs

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.

Equations
Instances For

    Address of the next unconsumed input bit.

    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

          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
                  structure Complexity.RAM.Structured.UnaryDecode.CursorReady (inputLength : ) (remaining : List Bool) (offset value : ) (store : Store) :

                  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.

                  • total_eq : offset + remaining.length = inputLength

                    Consumed and remaining bits account for the original input.

                  • value_le_offset : value offset

                    The current field accumulator cannot exceed the absolute cursor offset.

                  • verdict_eq : store verdictReg = 0

                    No successful terminator has been recorded yet.

                  • value_eq : store valueReg = value

                    The accumulator contains the current field's consumed one-bits.

                  • pointer_eq : store pointerReg = inputBase + offset

                    The cursor points to the first remaining bit.

                  • remaining_eq : store remainingReg = remaining.length

                    The remaining-length register agrees with the semantic suffix.

                  • one_eq : store oneReg = 1

                    The parser's constant-one register is initialized.

                  • active_eq : store activeReg = 1

                    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

                    Exact transition count for invoking mainLoop at a semantic suffix.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For

                      Exact compiled transition count through the first terminator or exhaustion.

                      Equations
                      Instances For

                        Explicit logarithmic-time budget.

                        Equations
                        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.
                            Instances For