Terminal Restriction #
This file contains the algorithm to restrict rules to either rewrite to a single terminal or only nonterminals.
Main definitions #
ContextFreeGrammar.restrictTerminals: Removes all rules which do not rewrite to a single terminal or nonterminals only. Adds corresponding rules to preserve the language.
Main theorems #
ContextFreeGrammar.restrictTerminals_correct: The transformed grammar's language coincides with the original
References #
- [John E. Hopcroft, Rajeev Motwani, and Jeffrey D. Ullman. 2006. Introduction to Automata Theory, Languages, and Computation (3rd Edition). Addison-Wesley Longman Publishing Co., Inc., USA.] [Hopcroft et al. 2006]
Definitions of embeding into and projecting to the type of symbols of the new grammar
Intuitive embedding of symbols of the original grammar into symbols of the new grammar's type
Equations
Instances For
Intuitive embedding of strings of the original grammar into strings of the new grammar's type
Equations
Instances For
Embedding of symbols of the original grammar into nonterminals of the new grammar
Equations
Instances For
Embedding of strings of the original grammar into nonterminal (symbol) strings of the new grammar
Equations
Instances For
Projection from symbols of the new grammars type into symbols of the original grammar
Equations
Instances For
Projection from strings of the new grammars type into strings of the original grammar
Equations
Instances For
Definition of ContextFreeGrammar.restrictTerminals, the algorithm to restrict rules s.t.
terminals occur only as the single symbol at the right-hand side of a rule.
Computes rules r' : T -> t, for all terminals t occuring in r.output
Equations
- One or more equations did not get rendered due to their size.
Instances For
If r.output is a single terminal, we lift the rule to the new grammar, otherwise add new rules
for each terminal symbol in r.output and right-lift the rule, i.e., replace all terminals with
nonterminals
Equations
- One or more equations did not get rendered due to their size.
Instances For
Compute all lifted rules
Equations
Instances For
Construct new grammar, using the lifted rules. Each rule's output is either a single terminal or only nonterminals