Documentation

Cslib.Computability.Automata.EpsilonNA.ThompsonConstruction

Thompson's construction #

Thompson's construction turns a regular expression into an εNA with a single initial state and at most one accepting state [Tho68]. This file defines the automata it is assembled from, with their languages.

Main definitions #

Main statements #

References #

def Cslib.Automata.εNA.FinAcc.zero {Symbol : Type u_1} :
FinAcc Unit Symbol

An automaton with a single state, initial but not accepting, and no transitions.

Equations
Instances For

    An automaton with a single state, initial and accepting, and no transitions.

    Equations
    Instances For
      def Cslib.Automata.εNA.FinAcc.char {Symbol : Type u_1} (x : Symbol) :
      FinAcc Bool Symbol

      An automaton with two states, false initial and true accepting, joined by an x-transition.

      Equations
      Instances For
        @[simp]
        theorem Cslib.Automata.εNA.FinAcc.language_char {Symbol : Type u_1} (x : Symbol) :
        def Cslib.Automata.εNA.FinAcc.sum {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
        FinAcc (S₁ ⊕ S₂) Symbol

        The disjoint sum of a and b: their states and transitions side by side (LTS.unionSum), with the initial and the accepting states of both.

        Equations
        Instances For
          @[simp]
          theorem Cslib.Automata.εNA.FinAcc.language_sum {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
          def Cslib.Automata.εNA.FinAcc.union {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
          FinAcc (Bool ⊕ S₁ ⊕ S₂) Symbol

          The union of a and b: their disjoint sum, with a single initial state and a single accepting state added by toSingleStartAccept.

          Equations
          Instances For
            @[simp]
            theorem Cslib.Automata.εNA.FinAcc.language_union {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
            inductive Cslib.Automata.εNA.FinAcc.ConcatTr {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
            S₁ ⊕ S₂ → Option Symbol → S₁ ⊕ S₂ → Prop

            The transitions of concat a b, whose states are those of a followed by those of b.

            Instances For
              def Cslib.Automata.εNA.FinAcc.concat {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
              FinAcc (S₁ ⊕ S₂) Symbol

              The concatenation of a and b: ε-transitions lead from the accepting states of a to the initial states of b.

              Equations
              Instances For
                theorem Cslib.Automata.εNA.FinAcc.concat_mTr_inr {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} {a : FinAcc S₁ Symbol} {b : FinAcc S₂ Symbol} {s t : S₂} {μs : List (Option Symbol)} (h : (a.concat b).MTr (Sum.inr s) μs (Sum.inr t)) :
                b.MTr s μs t

                A run of concat a b between two states of b is a run of b.

                theorem Cslib.Automata.εNA.FinAcc.concat_mTr_inl {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} {a : FinAcc S₁ Symbol} {b : FinAcc S₂ Symbol} {s : S₁} {t : S₂} {μs : List (Option Symbol)} (h : (a.concat b).MTr (Sum.inl s) μs (Sum.inr t)) :
                ∃ s₁ ∈ a.accept, ∃ s₂ ∈ b.start, ∃ (μs₁ : List (Option Symbol)) (μs₂ : List (Option Symbol)), a.MTr s μs₁ s₁ ∧ b.MTr s₂ μs₂ t ∧ μs = μs₁ ++ none :: μs₂

                A run of concat a b from a state of a to a state of b is a run of a to an accepting state, an ε-transition to an initial state of b, and a run of b.

                @[simp]
                theorem Cslib.Automata.εNA.FinAcc.language_concat {Symbol : Type u_1} {S₁ : Type u_2} {S₂ : Type u_3} (a : FinAcc S₁ Symbol) (b : FinAcc S₂ Symbol) :
                inductive Cslib.Automata.εNA.FinAcc.StarTr {Symbol : Type u_1} {S₁ : Type u_2} (a : FinAcc S₁ Symbol) :
                Unit ⊕ S₁ → Option Symbol → Unit ⊕ S₁ → Prop

                The transitions of star a, whose states are a fresh hub inl () and the states of a.

                Instances For
                  def Cslib.Automata.εNA.FinAcc.star {Symbol : Type u_1} {S₁ : Type u_2} (a : FinAcc S₁ Symbol) :
                  FinAcc (Unit ⊕ S₁) Symbol

                  The Kleene star of a: a fresh hub state, initial and accepting, with ε-transitions to the initial states of a and from its accepting states.

                  Equations
                  Instances For
                    theorem Cslib.Automata.εNA.FinAcc.star_mTr_inr {Symbol : Type u_1} {S₁ : Type u_2} {a : FinAcc S₁ Symbol} {s : S₁} {μs : List (Option Symbol)} (h : a.star.MTr (Sum.inr s) μs (Sum.inl ())) :
                    ∃ t ∈ a.accept, ∃ (μs₁ : List (Option Symbol)) (μs₂ : List (Option Symbol)), a.MTr s μs₁ t ∧ a.star.MTr (Sum.inl ()) μs₂ (Sum.inl ()) ∧ μs = μs₁ ++ none :: μs₂

                    A run of star a from a state of a to the hub is a run of a to an accepting state, an ε-transition to the hub, and a run from the hub back to the hub.

                    theorem Cslib.Automata.εNA.FinAcc.reduceOption_mem_kstar_of_star_mTr {Symbol : Type u_1} {S₁ : Type u_2} {a : FinAcc S₁ Symbol} {μs : List (Option Symbol)} (h : a.star.MTr (Sum.inl ()) μs (Sum.inl ())) :

                    A run of star a from the hub back to the hub reads a word of (language a)∗.

                    theorem Cslib.Automata.εNA.FinAcc.exists_star_mTr_of_mem_kstar {Symbol : Type u_1} {S₁ : Type u_2} {a : FinAcc S₁ Symbol} {xs : List Symbol} (hxs : xs ∈ KStar.kstar (Acceptor.language a)) :
                    ∃ (μs : List (Option Symbol)), μs.reduceOption = xs ∧ a.star.MTr (Sum.inl ()) μs (Sum.inl ())

                    Every word of (language a)∗ is read by a run of star a from the hub back to the hub.

                    @[simp]