A Regularity Measure for Context Free Grammars

Parikh's theorem states that every Context Free Language (CFL) has the same Parikh image as that of a regular language. A finite state automaton accepting such a regular language is called a Parikh-equivalent automaton. In the worst case, the number of states in any non-deterministic Parikh-equivalent automaton is exponentially large in the size of the Context Free Grammar (CFG). We associate a regularity width d with a CFG that measures the closeness of the CFL with regular languages. The degree m of a CFG is one less than the maximum number of variable occurrences in the right hand side of any production. Given a CFG with n variables, we construct a Parikh-equivalent non-deterministic automaton whose number of states is upper bounded by a polynomial in $n (d^{2d(m+1)}), the degree of the polynomial being a small fixed constant. Our procedure is constructive and runs in time polynomial in the size of the automaton. In the terminology of parameterized complexity, we prove that constructing a Parikh-equivalent automaton for a given CFG is Fixed Parameter Tractable (FPT) when the degree m and regularity width d are parameters. We also give an example from program verification domain where the degree and regularity are small compared to the size of the grammar.

[1]  Jörg Flum,et al.  Parameterized Complexity Theory , 2006, Texts in Theoretical Computer Science. An EATCS Series.

[2]  Thomas Schwentick,et al.  On the Complexity of Equational Horn Clauses , 2005, CADE.

[3]  Anthony Widjaja Lin,et al.  Parikh Images of Regular Languages: Complexity and Applications , 2010, ArXiv.

[4]  Anthony Widjaja Lin,et al.  Algorithmic metatheorems for decidable LTL model checking over infinite systems , 2010, FoSSaCS.

[5]  Michael R. Fellows,et al.  Parameterized complexity: A framework for systematically confronting computational intractability , 1997, Contemporary Trends in Discrete Mathematics.

[6]  Michael R. Fellows,et al.  Parameterized Complexity , 1998 .

[7]  Mikolaj Bojanczyk A new algorithm for testing if a regular language is locally threshold testable , 2007, Inf. Process. Lett..

[8]  Pierre Ganty,et al.  Complexity of pattern-based verification for multithreaded programs , 2011, POPL '11.

[9]  M. W. Shields An Introduction to Automata Theory , 1988 .

[10]  Jeffrey D. Ullman,et al.  Introduction to Automata Theory, Languages and Computation , 1979 .

[11]  Dexter Kozen,et al.  Parikh's theorem in commutative Kleene algebra , 1999, Proceedings. 14th Symposium on Logic in Computer Science (Cat. No. PR00158).

[12]  Jonathan Goldstine,et al.  A simplified proof of Parikh's theorem , 1977, Discret. Math..

[13]  Oscar H. Ibarra,et al.  Reversal-Bounded Multicounter Machines and Their Decision Problems , 1978, JACM.

[14]  Pierre Ganty,et al.  Parikh's Theorem: A simple and direct construction , 2010, ArXiv.

[15]  D. L. Pilling,et al.  Commutative Regular Equations and Parikh's Theorem , 1973 .

[16]  Rohit Parikh,et al.  On Context-Free Languages , 1966, JACM.