I am working on CFG grammars, LL grammars in particular and I encountered the following theorem in the slides of presentations written by my professor:A CFG grammar cannot be left-factored if all elements in the FIRST-set of one factorizable rule belong to the FIRST-set of the alternative rule. Mathematically speaking:$$A \rightarrow \alpha\beta_1 | \alpha\beta_2 , \forall x \in \text{FIRST}(\alpha\beta_1)\wedge x \in \text{FIRST}(\alpha\beta_2) \implies \text{Cannot left-factorize}$$Is it correct? I think it is not!Consider grammar rules $A \rightarrow aB | a C$ This thing can be left-factorized in: $A \rightarrow aD; D \rightarrow B|C$. But considering the theorem such a grammar is not supposed to be left-factorizable because $\text{FIRST}(aB) =\text{FIRST}(aC) = {a}$.Which one is the correct version of this theorem? Thankyou
Is this theorem about left-factored grammars correct?
formal languages;context free;formal grammars