Right-Regular Grammars as Unrestricted Grammars #
This file gives an alternative characterization of right-regular grammars as unrestricted grammars satisfying an additional structural property on their rules.
Overview #
A standard unrestricted grammar has rules of the form
input_L ++ [nonterminal input_N] ++ input_R → output_string
where there are no restrictions on the relationship between the left- and right-hand sides.
A right-regular grammar is one where each rule is context-free (i.e., input_L = [] and
input_R = []) and the output string takes one of three forms:
[terminal a, nonterminal B]for some terminalaand nonterminalB,[terminal a]for some terminala, or[](the empty string).
This file proves that the unrestricted characterization agrees with the
RG_grammar presentation.
Main declarations #
is_RG_via_rg— language class induced byRG_grammaris_RG_via_rg_implies_is_RG— conversion to the default unrestricted characterizationis_RG_implies_is_RG_via_rg— extraction of anRG_grammarwitnessis_RG_iff_is_RG_via_rg— equivalence of the two characterizations
Forward direction: RG_grammar → right-regular unrestricted grammar #
Build an unrestricted grammar from a right-regular grammar.
Equations
- grammar_of_RG g = { nt := g.nt, initial := g.initial, rules := List.map grule_of_RG_rule g.rules }
Instances For
The unrestricted grammar built from a right-regular grammar satisfies the right-regular property.
Derivation in the original RG_grammar coincides with derivation in the
constructed unrestricted grammar.
The language of the constructed unrestricted grammar equals that of the original right-regular grammar.
Every language generated by an RG_grammar satisfies the default
unrestricted characterization.
Backward direction: right-regular unrestricted grammar → RG_grammar #
Convert an unrestricted grammar rule (from a right-regular grammar) to an RG_rule.
Uses the right-regular output property to determine the rule form.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Construct an RG_grammar from a right-regular unrestricted grammar.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Derivation in the constructed RG_grammar coincides with derivation in the original
unrestricted grammar.
The language of the constructed RG_grammar equals that of the original grammar.
Every language satisfying the default unrestricted characterization is generated by
an RG_grammar.
Equivalence #
The default unrestricted characterization of regularity agrees with the
RG_grammar characterization.