Online Context-Free Recognition in OMv Time

Authors Bartłomiej Dudek , Paweł Gawrychowski

Thumbnail PDF


  • Filesize: 0.81 MB
  • 9 pages

Document Identifiers

Author Details

Bartłomiej Dudek
  • Institute of Computer Science, University of Wrocław, Poland
Paweł Gawrychowski
  • Institute of Computer Science, University of Wrocław, Poland

Cite AsGet BibTex

Bartłomiej Dudek and Paweł Gawrychowski. Online Context-Free Recognition in OMv Time. In 35th Annual Symposium on Combinatorial Pattern Matching (CPM 2024). Leibniz International Proceedings in Informatics (LIPIcs), Volume 296, pp. 13:1-13:9, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2024)


One of the classical algorithmic problems in formal languages is the context-free recognition problem: for a given context-free grammar and a length-n string, check if the string belongs to the language described by the grammar. Already in 1975, Valiant showed that this can be solved in {O}̃(n^ω) time, where ω is the matrix multiplication exponent. More recently, Abboud, Backurs, and Vassilevska Williams [FOCS 2015] showed that any improvement on this complexity would imply a breakthrough algorithm for the k-Clique problem. We study the natural online version of this problem, where the input string w[1..n] is given left-to-right, and after having seen every prefix w[1..t] we should output if it belongs to the language. The goal is to maintain the total running time to process the whole input. Even though this version has been extensively studied in the past, the best known upper bound was {O}(n³/log²n). We connect the complexity of online context-free recognition to that of Online Matrix-Vector Multiplication, which allows us to improve the upper bound to n³/2^{Ω(√{log{n}})}.

Subject Classification

ACM Subject Classification
  • Theory of computation → Grammars and context-free languages
  • data structures
  • context-free grammar parsing
  • online matrix-vector multiplication


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads


  1. Amir Abboud, Arturs Backurs, and Virginia Vassilevska Williams. If the current clique algorithms are optimal, so is Valiant’s parser. In FOCS, pages 98-117. IEEE Computer Society, 2015. Google Scholar
  2. Alfred V. Aho, Ravi Sethi, and Jeffrey D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley series in computer science / World student series edition. Addison-Wesley, 1986. Google Scholar
  3. Noam Chomsky. On certain formal properties of grammars. Inf. Control., 2(2):137-167, 1959. Google Scholar
  4. John Cocke and Jacob T. Schwartz. Programming languages and their compilers: Preliminary notes (technical report) (2nd revised ed. Technical report, CIMS, NYU, 1970. Google Scholar
  5. Shay B. Cohen, Giorgio Satta, and Michael Collins. Approximate PCFG parsing using tensor decomposition. In HLT-NAACL, pages 487-496. The Association for Computational Linguistics, 2013. Google Scholar
  6. Richard Durbin, Sean R. Eddy, Anders Krogh, and Graeme J. Mitchison. Biological Sequence Analysis: Probabilistic Models of Proteins and Nucleic Acids. Cambridge University Press, 1998. Google Scholar
  7. Hervé Gallaire. Recognition time of context-free languages by on-line turing machines. Inf. Control., 15(3):288-295, 1969. Google Scholar
  8. Susan L. Graham, Michael A. Harrison, and Walter L. Ruzzo. An improved context-free recognizer. ACM Trans. Program. Lang. Syst., 2(3):415-462, 1980. Google Scholar
  9. M. A. Harrison. Introduction to Formal Language Theory. Addison-Wesley Longman Publishing Co., Inc., USA, 1st edition, 1978. Google Scholar
  10. Monika Henzinger, Sebastian Krinninger, Danupon Nanongkai, and Thatchaphol Saranurak. Unifying and strengthening hardness for dynamic problems via the online matrix-vector multiplication conjecture. In STOC, pages 21-30. ACM, 2015. Google Scholar
  11. Dan Jurafsky and James H. Martin. Speech and language processing: an introduction to natural language processing, computational linguistics, and speech recognition, 2nd Edition. Prentice Hall series in artificial intelligence. Prentice Hall, Pearson Education International, 2009. Google Scholar
  12. Tadao Kasami. An efficient recognition and syntax algorithm for context-free language. Technical Report AFCRL-65-758, Air Force Cambridge Research Lab, Bed-ford, MA., 1965. Google Scholar
  13. Flip Korn, Barna Saha, Divesh Srivastava, and Shanshan Ying. On repairing structural problems in semi-structured data. Proc. VLDB Endow., 6(9):601-612, 2013. Google Scholar
  14. Kasper Green Larsen and R. Ryan Williams. Faster online matrix-vector multiplication. In SODA, pages 2182-2189. SIAM, 2017. Google Scholar
  15. Lillian Lee. Fast context-free grammar parsing requires fast boolean matrix multiplication. J. ACM, 49(1):1-15, 2002. Google Scholar
  16. Adam Pauls and Dan Klein. K-best A* parsing. In ACL/IJCNLP, pages 958-966. The Association for Computer Linguistics, 2009. Google Scholar
  17. Alexander M. Rush, David A. Sontag, Michael Collins, and Tommi S. Jaakkola. On dual decomposition and linear programming relaxations for natural language processing. In EMNLP, pages 1-11. ACL, 2010. Google Scholar
  18. Wojciech Rytter. Fast recognition of pushdown automaton and context-free languages. Information and Control, 67(1-3):12-22, 1985. Google Scholar
  19. Wojciech Rytter. Context-free recognition via shortest paths computation: A version of Valiant’s algorithm. Theor. Comput. Sci., 143(2):343-352, 1995. Google Scholar
  20. Joel I. Seiferas. A simplified lower bound for context-free-language recognition. Inf. Control., 69(1-3):255-260, 1986. Google Scholar
  21. Michael Sipser. Introduction to the theory of computation. PWS Publishing Company, 1997. Google Scholar
  22. Richard Socher, John Bauer, Christopher D. Manning, and Andrew Y. Ng. Parsing with compositional vector grammars. In ACL (1), pages 455-465. The Association for Computer Linguistics, 2013. Google Scholar
  23. Leslie G. Valiant. General context-free recognition in less than cubic time. J. Comput. Syst. Sci., 10(2):308-315, 1975. Google Scholar
  24. Virginia Vassilevska Williams, Yinzhan Xu, Zixuan Xu, and Renfei Zhou. New bounds for matrix multiplication: from alpha to omega. In SODA, pages 3792-3835. SIAM, 2024. Google Scholar
  25. Daniel H. Younger. Recognition and parsing of context-free languages in time n³. Inf. Control., 10(2):189-208, 1967. Google Scholar