Documentation

Complexitylib.Models.RandomAccessMachine.Structured.Scanner.Defs

Finite-state scanners for the structured RAM frontend #

Scanner.Spec describes a finite automaton using numeric state codes. The compiler below realizes it as a table-driven structured RAM program. The state bound and transition-closure fields are the complete trusted interface needed by the generic correctness and resource proof.

A total finite-state Boolean scanner with contiguous numeric state codes.

  • stateCount :

    Number of valid state codes.

  • initial :

    Initial state code.

  • initial_lt : self.initial < self.stateCount

    The initial code is valid.

  • step : Bool

    One state transition.

  • step_lt (state : ) : state < self.stateCount∀ (bit : Bool), self.step state bit < self.stateCount

    Transitions preserve valid state codes.

  • accept : Bool

    Final Boolean verdict.

Instances For

    A scanner specification over an explicitly enumerable Lean state type.

    FinEnum retains a concrete equivalence with an initial segment of natural numbers, so lowering remains executable while consumers reason using their domain-specific state type.

    • initial : State

      Initial typed state.

    • step : StateBoolState

      One typed state transition.

    • accept : StateBool

      Final Boolean verdict.

    Instances For
      def Complexity.RAM.Structured.Scanner.TypedSpec.code {State : Type} [FinEnum State] (state : State) :

      Numeric state code chosen by the explicit enumeration.

      Equations
      Instances For

        Lower a typed scanner to the verified numeric scanner interface.

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

          Remaining input length and final verdict register.

          Equations
          Instances For

            Current numeric automaton state.

            Equations
            Instances For

              Scratch address used for table lookups.

              Equations
              Instances For

                Register containing the transition-table base address.

                Equations
                Instances For

                  Register containing the verdict-table base address.

                  Equations
                  Instances For

                    Address of one verdict-table entry.

                    Equations
                    Instances For

                      Reserved-prefix input layout for a scanner.

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

                        The six fixed setup destinations below the tables.

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

                          Value written to one setup destination.

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

                            Constant and table writes performed before scanning.

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

                              Seven-instruction scanner body, independent of the particular automaton.

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

                                Two-instruction final verdict lookup.

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

                                  Exact compiled transition count.

                                  Equations
                                  Instances For

                                    Explicit logarithmic-cost time budget.

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    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
                                          @[reducible, inline]

                                          Input store for a typed scanner.

                                          Equations
                                          Instances For
                                            @[reducible, inline]

                                            Structured RAM program generated from a typed scanner.

                                            Equations
                                            Instances For
                                              @[reducible, inline]

                                              Concrete RAM program generated from a typed scanner.

                                              Equations
                                              Instances For
                                                @[reducible, inline]

                                                Exact transition count for a typed scanner.

                                                Equations
                                                Instances For
                                                  @[reducible, inline]

                                                  Explicit logarithmic-time budget for a typed scanner.

                                                  Equations
                                                  Instances For
                                                    @[reducible, inline]

                                                    Explicit peak-space budget for a typed scanner.

                                                    Equations
                                                    Instances For
                                                      @[reducible, inline]

                                                      Shifted quasilinear comparison function for a typed scanner.

                                                      Equations
                                                      Instances For