Languages #
This file contains the definition and operations on formal languages over an alphabet. Note that "strings" are implemented as lists over the alphabet.
Union and concatenation define a Kleene algebra over the languages.
In addition to that, we define a reversal of a language and prove that it behaves well with respect to other language operations.
Notation #
l + m: union of languageslandml - m: difference of languageslandml * m: language of stringsx ++ ysuch thatx ∈ landy ∈ ml ^ n: language of strings consisting ofnmembers oflconcatenated together1: language consisting of only the empty string. This is because it is the unit of the*operator.l∗: Kleene star – language of strings consisting of arbitrarily many members oflconcatenated together. Note that this notation uses the Unicode asterisk operator∗, as opposed to the more common ASCII asterisk*.lᶜ: complement, language of stringsxsuch thatx ∉ ll ⊓ m: intersection of languageslandm
Main definitions #
Language α: a set of strings over the alphabetαl.map f: transform a languageloverαinto a language overβby translating throughf : α → β
Main theorems #
Language.self_eq_mul_add_iff: Arden's lemma – if a languagelsatisfies the equationl = m * l + n, andmdoesn't contain the empty string, thenlis the languagem∗ * n
Equations
- One or more equations did not get rendered due to their size.
Equations
- Language.instMembershipList = { mem := Set.Mem }
Equations
- Language.instSingletonList = { singleton := Set.singleton }
Equations
- Language.instInsertList = { insert := Set.insert }
Equations
- Language.instInhabited = { default := ∅ }
The subtraction of two languages is their difference.
Equations
- Language.instSub = { sub := sdiff }
The product of two languages l and m is the language made of the strings x ++ y where
x ∈ l and y ∈ m.
Equations
- Language.instMul = { mul := Set.image2 fun (x1 x2 : List α) => x1 ++ x2 }
Equations
- One or more equations did not get rendered due to their size.
Equations
- One or more equations did not get rendered due to their size.
Language.reverse as a ring isomorphism to the opposite ring.
Equations
- One or more equations did not get rendered due to their size.