Prime normal form and equivalence of simple grammars

  • Authors:
  • Cédric Bastien;Jurek Czyzowicz;Wojciech Fraczak;Wojciech Rytter

  • Affiliations:
  • Dépt d'informatique, Université du Québec en Outaouais, Gatineau, PQ, Canada;Dépt d'informatique, Université du Québec en Outaouais, Gatineau, PQ, Canada;Dépt d'informatique, Université du Québec en Outaouais, Gatineau, PQ, Canada;Inst. of Informatics, Warsaw University, Warsaw, Poland

  • Venue:
  • CIAA'05 Proceedings of the 10th international conference on Implementation and Application of Automata
  • Year:
  • 2005

Quantified Score

Hi-index 0.00

Visualization

Abstract

A prefix-free language is a prime if it cannot be decomposed into a concatenation of two prefix-free languages. We show that we can check in polynomial time if a language generated by a simple context-free grammar is a prime. Our algorithm computes a canonical representation of a simple language, converting its arbitrary simple grammar into Prime Normal Form (PNF); a simple grammar is in PNF if all its nonterminals define primes. We also improve the complexity of testing the equivalence of simple grammars. The best previously known algorithm for this problem worked in O(n13) time. We improve it to O(n7 log2n) and O(n5 polylog v) deterministic time, and O(n4 polylog n) randomized time, where n is the total size of the grammars involved, and v is the length of a shortest string derivable from a nonterminal, maximized over all nonterminals. Our improvement is based on a version of Caucal's algorithm from [1].