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.
Equations
- instMembershipListLanguage = { mem := Set.Mem }
Equations
- instCompleteAtomicBooleanAlgebraLanguage = Set.completeAtomicBooleanAlgebra
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 (x x_1 : List α) => x ++ x_1 }
The Kleene star of a language L
is the set of all strings which can be written by
concatenating strings from L
.
Equations
- Language.instSemiring = Semiring.mk ⋯ ⋯ ⋯ ⋯ npowRec ⋯ ⋯
Equations
- Language.instKleeneAlgebra = let __src := Language.instSemiring; let __src_1 := Set.completeAtomicBooleanAlgebra; KleeneAlgebra.mk ⋯ ⋯ ⋯ ⋯ ⋯
Language.reverse
as a ring isomorphism to the opposite ring.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Symbols for use by all kinds of grammars.
- terminal: {T : Type u_1} → {N : Type u_2} → T → Symbol T N
Terminal symbols (of the same type as the language)
- nonterminal: {T : Type u_1} → {N : Type u_2} → N → Symbol T N
Nonterminal symbols (must not be present at the end of word being generated)
Instances For
Equations
- instDecidableEqSymbol = decEqSymbol✝
Equations
- instFintypeSymbol = Fintype.ofEquiv (T ⊕ N) (Symbol.proxyTypeEquiv T N)