Documentation

Complexitylib.Models.FiniteAutomaton.Defs

Two-way finite automata #

Adapted from OpenAI's one-way-liveness formalization (25 September 2026): https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Combinatorics/Automata/Model.lean

The input is enclosed by two distinct endmarkers. Transitions cannot cross these boundaries. Acceptance means that a finite run reaches an accepting state, with no requirement that rejected inputs halt. The Boolean positive parameter selects whether a length-zero accepting run is permitted (false) or excluded (true). NoLeft permits stationary moves as well as right moves. State counts include all states. These are finite automata, independently of the work tapes and time accounting of the library's Turing machines.

inductive Complexity.FiniteAutomaton.Symbol (Alpha : Type u_1) :
Type u_1

The input alphabet with distinct left and right endmarkers.

Instances For

    A two-way head may move left, stay, or move right.

    Instances For

      The relation between two head positions specified by a move.

      Equations
      Instances For
        def Complexity.FiniteAutomaton.scanned {Alpha : Type u_1} (w : List Alpha) (i : Fin (w.length + 2)) :
        Symbol Alpha

        The finite word including both endmarkers.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          @[reducible, inline]
          abbrev Complexity.FiniteAutomaton.Configuration {Alpha : Type u_1} (w : List Alpha) (n : ℕ) :

          A head position on the endmarked word and a finite control state.

          Equations
          Instances For
            structure Complexity.FiniteAutomaton.DMachine (Alpha : Type u_1) (s : ℕ) :
            Type u_1

            A deterministic two-way finite automaton with exactly s named states.

            Instances For
              structure Complexity.FiniteAutomaton.NMachine (Alpha : Type u_1) (n : ℕ) :
              Type u_1

              A nondeterministic two-way finite automaton with exactly n named states.

              Instances For
                def Complexity.FiniteAutomaton.DMachine.Step {Alpha : Type u_1} {s : ℕ} (M : DMachine Alpha s) (w : List Alpha) (c c' : Configuration w s) :

                A deterministic transition and its associated head movement.

                Equations
                Instances For
                  def Complexity.FiniteAutomaton.NMachine.Step {Alpha : Type u_1} {n : ℕ} (M : NMachine Alpha n) (w : List Alpha) (c c' : Configuration w n) :

                  A chosen nondeterministic transition and its associated head movement.

                  Equations
                  Instances For
                    def Complexity.FiniteAutomaton.FiniteRun {C : Type u_1} (positive : Bool) (step : C → C → Prop) (c c' : C) :

                    The positive convention explicitly excludes a length-zero computation.

                    Equations
                    Instances For
                      def Complexity.FiniteAutomaton.DMachine.Accepts {Alpha : Type u_1} {s : ℕ} (M : DMachine Alpha s) (positive : Bool) (w : List Alpha) :

                      A finite run from the left endmarker reaches an accepting state.

                      Equations
                      Instances For
                        def Complexity.FiniteAutomaton.NMachine.Accepts {Alpha : Type u_1} {n : ℕ} (M : NMachine Alpha n) (positive : Bool) (w : List Alpha) :

                        Some finite run from the left endmarker reaches an accepting state.

                        Equations
                        Instances For
                          def Complexity.FiniteAutomaton.NMachine.NoLeft {Alpha : Type u_1} {n : ℕ} (M : NMachine Alpha n) :

                          No transition moves the input head left; stationary moves are allowed.

                          Equations
                          Instances For
                            def Complexity.FiniteAutomaton.NMachine.Recognizes {Alpha : Type u_1} {n : ℕ} (M : NMachine Alpha n) (positive : Bool) (L : Set (List Alpha)) :

                            The accepted words are exactly the members of the language.

                            Equations
                            Instances For
                              def Complexity.FiniteAutomaton.DMachine.Recognizes {Alpha : Type u_1} {s : ℕ} (M : DMachine Alpha s) (positive : Bool) (L : Set (List Alpha)) :

                              The accepted words are exactly the members of the language.

                              Equations
                              Instances For

                                An alphabet-independent polynomial bound for deterministic simulation.

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

                                  A polynomial deterministic simulation bound restricted to one-way nondeterministic inputs.

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