Documentation

CslibFrontier.Computability.Languages.RegularLanguage

Further closure properties of regular languages #

Regular languages are closed under images along letter maps (Language.map), the projection step of the translation of monadic second-order logic into automata Thomas, Section 3. The alphabet may be infinite. Three families of languages defined by the positions of letters are regular for every pair of letter predicates p, q: the words all of whose letters satisfy p, the words with some letter satisfying p, and the words with a letter satisfying p strictly before a letter satisfying q. They are the atomic languages of the same translation; the first two are also stated over positions w[i].

Languages given by conditions on words, {w | P w}, are closed under the connectives through the existing CSLib closures, with no set-builder restatement: hP.inf hQ proves regularity of {w | P w ∧ Q w}, and likewise IsRegular.add for ∨, IsRegular.compl for ¬, and IsRegular.top/IsRegular.zero for True/False. Finite conjunctions over an index type are IsRegular.setOf_forall.

Main results #

References #

theorem Cslib.Language.IsRegular.map {Symbol : Type u_1} {Symbol' : Type u_2} (f : Symbol → Symbol') {l : Language Symbol} (h : l.IsRegular) :

The image of a regular language along a letter map is regular.

theorem Cslib.Language.IsRegular.setOf_forall_mem {Symbol : Type u_1} (p : Symbol → Prop) :
Language.IsRegular {w : List Symbol | ∀ a ∈ w, p a}

The words all of whose letters satisfy p form a regular language.

theorem Cslib.Language.IsRegular.setOf_exists_mem {Symbol : Type u_1} (p : Symbol → Prop) :
Language.IsRegular {w : List Symbol | ∃ a ∈ w, p a}

The words with some letter satisfying p form a regular language.

theorem Cslib.Language.IsRegular.setOf_exists_lt {Symbol : Type u_1} (p q : Symbol → Prop) :
Language.IsRegular {w : List Symbol | ∃ (i : Fin w.length) (j : Fin w.length), i < j ∧ p w[i] ∧ q w[j]}

The words with a letter satisfying p strictly before a letter satisfying q form a regular language.

theorem Cslib.Language.IsRegular.setOf_forall_getElem {Symbol : Type u_1} (p : Symbol → Prop) :
Language.IsRegular {w : List Symbol | ∀ (i : Fin w.length), p w[i]}

The words all of whose positions carry a letter satisfying p form a regular language.

theorem Cslib.Language.IsRegular.setOf_exists_getElem {Symbol : Type u_1} (p : Symbol → Prop) :
Language.IsRegular {w : List Symbol | ∃ (i : Fin w.length), p w[i]}

The words with some position carrying a letter satisfying p form a regular language.

theorem Cslib.Language.IsRegular.setOf_forall {Symbol : Type u_1} {ι : Type u_3} [Finite ι] {P : ι → List Symbol → Prop} (h : ∀ (i : ι), Language.IsRegular {w : List Symbol | P i w}) :
Language.IsRegular {w : List Symbol | ∀ (i : ι), P i w}

A finite conjunction of regular conditions on words is regular.