Documentation

Complexitylib.Models.FiniteAutomaton.OneWayLiveness.Internal.Normalization

One-way-liveness proof: Normalization #

Adapted from OpenAI's formalization at revision adc7f1241b42e322a6451854ab7e4b4c146bf78a. Source: https://github.com/openai/math/blob/adc7f1241b42e322a6451854ab7e4b4c146bf78a/lean/OAI/Combinatorics/Automata/Normalization.lean

Module and namespace names, imports, and formatting are adapted to complexitylib. The machine definitions are shared through Models.FiniteAutomaton.Defs.

A deterministic automaton on an arbitrary state type.

Instances For
    @[reducible, inline]

    A position on the endmarked word and a control state.

    Equations
    Instances For
      def Complexity.FiniteAutomaton.Machine.Step {Alpha Q : Type} (M : Machine Alpha Q) (w : List Alpha) (c c' : Config w) :

      One deterministic transition on the scanned input symbol.

      Equations
      Instances For
        def Complexity.FiniteAutomaton.Machine.Accepts {Alpha Q : Type} (M : Machine Alpha Q) (positive : Bool) (w : List Alpha) :

        A finite run from the initial configuration reaches an accepting state.

        Equations
        Instances For
          def Complexity.FiniteAutomaton.DMachine.toMachine {Alpha : Type} {s : ℕ} (M : DMachine Alpha s) :
          Machine Alpha (Fin s)

          View a numbered-state deterministic automaton as an arbitrary-state machine.

          Equations
          Instances For
            theorem Complexity.FiniteAutomaton.DMachine.toMachine_accepts {Alpha : Type} {s : ℕ} (M : DMachine Alpha s) (positive : Bool) (w : List Alpha) :
            M.toMachine.Accepts positive w ↔ M.Accepts positive w

            A fresh nonaccepting initial state copies the original initial row.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem Complexity.FiniteAutomaton.Machine.positiveCopy_step {Alpha Q : Type} (M : Machine Alpha Q) (w : List Alpha) (i : Fin (w.length + 2)) (q : Option Q) (c' : Config w) :
              M.positiveCopy.Step w (i, q) c' ↔ ∃ (r : Q), c'.2 = some r ∧ M.Step w (i, q.getD M.initial) (c'.1, r)
              noncomputable def Complexity.FiniteAutomaton.Machine.sinkCopy {Alpha Q : Type} (M : Machine Alpha Q) :
              Machine Alpha (Option Q)

              Sink normalization also replaces missing transitions at accepting states.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem Complexity.FiniteAutomaton.Machine.sinkCopy_step_old {Alpha Q : Type} (M : Machine Alpha Q) (w : List Alpha) (c : Config w) (c' : Config w) :
                M.sinkCopy.Step w (c.1, some c.2) c' ↔ c.2 ∈ M.accepting ∧ c' = (c.1, none) ∨ c.2 ∉ M.accepting ∧ ∃ (r : Q), c'.2 = some r ∧ M.Step w c (c'.1, r)
                theorem Complexity.FiniteAutomaton.scanned_eq_left_iff {Alpha : Type} (w : List Alpha) (i : Fin (w.length + 2)) :
                theorem Complexity.FiniteAutomaton.scanned_eq_right_iff {Alpha : Type} (w : List Alpha) (i : Fin (w.length + 2)) :

                The fresh sink state at the right endmarker.

                Equations
                Instances For
                  theorem Complexity.FiniteAutomaton.Machine.sinkCopy_reach_iff {Alpha Q : Type} (M : Machine Alpha Q) (w : List Alpha) (c : Config w) :