EncodedRG characterizes the regular languages #
This file proves that the right-regular-grammar encoding EncodedRG denotes exactly
the regular languages:
∀ L, L.IsRegular ↔ ∃ c : EncodedRG T, regularLanguageOf c = L
Soundness (every code denotes a regular language): an EncodedRG decodes — by
construction — to a right-regular grammar toRG c whose RG_language equals
regularLanguageOf c (both are the context-free language of the same underlying
context-free grammar, via CF_grammar_of_RG). Hence the language is is_RG, so
IsRegular.
The right-regular grammar denoted by an encoded right-regular grammar: it reads
each rule body back as a right-regular rule over the nonterminals Fin (toCFG c).ntCount.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The context-free grammar of toRG c is exactly the context-free grammar that
regularLanguageOf already uses, namely (toCFG c).toCFGrammar.
RG_language of toRG c is the language denoted by the code.
Soundness: every code denotes a regular language.
Completeness: every regular language is encoded #
Encode a right-regular rule (over Fin (k+1)) back into the EncodedRG body format.
Equations
- Regular.EncodedRG.rgRuleToBody (RG_rule.cons A a B) = (↑A, some (a, some ↑B))
- Regular.EncodedRG.rgRuleToBody (RG_rule.single A a) = (↑A, some (a, none))
- Regular.EncodedRG.rgRuleToBody (RG_rule.epsilon A) = (↑A, none)
Instances For
Completeness: every regular language is denoted by some code.
EncodedRG characterizes the regular languages (the library's class RG).