A right-regular grammar (RRG) is a CFG whose rules are all of the form: \[ X \to a Y \qquad \text{or} \qquad X \to \emptystring \]
Theorem: Every DFA-decidable language is RRG-decidable (and thus CFG-decidable).
Given any DFA \(D\), we can convert it into RRG \(G\) such that \(L(G) = L(D).\) In other words \(G\) generates string \(w\) iff \(D\) accepts \(w\).
Construction Example:
Equivalent grammar \(G\): \[\begin{align*} P &\to \fragment{0T\;|\;} \fragment{1R} \\ T &\to 0R\;|\; 1P \\ R &\to 0P\;|\; 1R \\ P &\to \emptystring \\ T &\to \emptystring \end{align*}\]
Parse tree for \(0110\):
Derivation of \(0110\): \[ \fragment{P} \fragment{\yields 0T} \fragment{\yields 01P} \fragment{\yields 011R} \fragment{\yields 0110P} \fragment{\yields 0110} \]
Computation sequence accepting \(0011\): \[ p, t, p, r, p \]
A right-regular grammar (RRG) is a CFG whose rules are all of the form: \[ X \to a Y \qquad \text{or} \qquad X \to \emptystring \]
Theorem: Every DFA-decidable language is RRG-decidable (and thus CFG-decidable).
Given any DFA \(D\), we can convert it into RRG \(G\) such that \(L(G) = L(D).\) In other words \(G\) generates string \(w\) iff \(D\) accepts \(w\).
Proof
We now prove \(L(G) = L(D)\).
A right-regular grammar (RRG) is a CFG whose rules are all of the form: \[ X \to a Y \qquad \text{or} \qquad X \to \emptystring \]
Theorem: Every DFA-decidable language is RRG-decidable (and thus CFG-decidable).
For \(X \in Q, a \in \Sigma\): \(\ X \to a Y\), where \(Y = \delta(X, a)\)
For \(X \in F\): \(\qquad \quad X \to \emptystring\)
Proof
A right-regular grammar (RRG) is a CFG whose rules are all of the form: \[ X \to a Y \qquad \text{or} \qquad X \to \emptystring \]
Theorem: Every DFA-decidable language is RRG-decidable (and thus CFG-decidable).
For \(X \in Q, a \in \Sigma\): \(\ X \to a Y\), where \(Y = \delta(X, a)\)
For \(X \in F\): \(\qquad \quad X \to \emptystring\)
Proof
Thus \(x \in L(G)\), showing \(L(D) \subseteq L(G)\).
Theorem: Any RRG-decidable language is NFA-decidable (and thus DFA-decidable).
Proof
Corollary: RRGs, DFAs, and NFAs have equivalent computational (decision) power.
Note this is almost the same as the DFA-to-RRG in reverse; nondeterministic transitions like \(X \stackrel{0}{\to} Y\) and \(X \stackrel{0}{\to} Z\) come from rules like \(X \to 0Y \or 0Z\).
What if there are also rules like \(X \to Y\)? Correspond to \(\emptystring\)-transitions \(X \stackrel{\emptystring}{\to} Y\)
A left-regular grammar (LRG) is a CFG whose rules are all of the form: \[ X \to Y a \qquad \text{or} \qquad X \to \emptystring \]
\[\begin{align*} A &\to 0B \\ B &\to A1 \\ A &\to \emptystring \end{align*}\]
\(\setbuild{0^n1^n}{n \in \N}\)… not regular!