Advertisement

Bar-Hillel Theorem Mechanization in Coq

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11541)

Abstract

Formal language theory has a deep connection with such areas as static code analysis, graph database querying, formal verification, and compressed data processing. Many application problems can be formulated in terms of languages intersection. The Bar-Hillel theorem states that context-free languages are closed under intersection with a regular set. This theorem has a constructive proof and thus provides a formal justification of correctness of the algorithms for applications mentioned above. Mechanization of the Bar-Hillel theorem, therefore, is both a fundamental result of formal language theory and a basis for the certified implementation of the algorithms for applications. In this work, we present the mechanized proof of the Bar-Hillel theorem in Coq.

Keywords

Formal languages Coq Bar-Hillel theorem Closure Intersection Regular language Context-free language 

Supplementary material

References

  1. 1.
    Abiteboul, S., Vianu, V.: Regular path queries with constraints. J. Comput. Syst. Sci. 58(3), 428–452 (1999). http://www.sciencedirect.com/science/article/pii/S0022000099916276MathSciNetCrossRefGoogle Scholar
  2. 2.
    Alkhateeb, F.: Querying RDF(S) with Regular Expressions. Theses, Université Joseph-Fourier - Grenoble I, June 2008. https://tel.archives-ouvertes.fr/tel-00293206
  3. 3.
    Bar-Hillel, Y., Perles, M., Shamir, E.: On formal properties of simple phrase structure grammars. Sprachtypologie und Universalienforschung 14, 143–172 (1961)MathSciNetzbMATHGoogle Scholar
  4. 4.
    Barthwal, A.: A formalisation of the theory of context-free languages in higher order logic. Ph.D. thesis, College of Engineering & Computer Science, The Australian National University, December 2010Google Scholar
  5. 5.
    Barthwal, A., Norrish, M.: Verified, executable parsing. In: Castagna, G. (ed.) ESOP 2009. LNCS, vol. 5502, pp. 160–174. Springer, Heidelberg (2009).  https://doi.org/10.1007/978-3-642-00590-9_12CrossRefGoogle Scholar
  6. 6.
    Barthwal, A., Norrish, M.: A formalisation of the normal forms of context-free grammars in HOL4. In: Dawar, A., Veith, H. (eds.) CSL 2010. LNCS, vol. 6247, pp. 95–109. Springer, Heidelberg (2010).  https://doi.org/10.1007/978-3-642-15205-4_11CrossRefGoogle Scholar
  7. 7.
    Barthwal, A., Norrish, M.: Mechanisation of PDA and grammar equivalence for context-free languages. In: Dawar, A., de Queiroz, R. (eds.) WoLLIC 2010. LNCS (LNAI), vol. 6188, pp. 125–135. Springer, Heidelberg (2010).  https://doi.org/10.1007/978-3-642-13824-9_11CrossRefzbMATHGoogle Scholar
  8. 8.
    Beigel, R., Gasarch, W.: A Proof that if \(L = L_1 \cap L_2\) where \(L_1\) is CFL and \(L_2\) is Regular then \(L\) is Context Free Which Does Not use PDAs. http://www.cs.umd.edu/~gasarch/BLOGPAPERS/cfg.pdf/
  9. 9.
    Bouajjani, A., Esparza, J., Maler, O.: Reachability analysis of pushdown automata: application to model-checking. In: Mazurkiewicz, A., Winkowski, J. (eds.) CONCUR 1997. LNCS, vol. 1243, pp. 135–150. Springer, Heidelberg (1997).  https://doi.org/10.1007/3-540-63141-0_10CrossRefGoogle Scholar
  10. 10.
    Doczkal, C., Kaiser, J.-O., Smolka, G.: A constructive theory of regular languages in Coq. In: Gonthier, G., Norrish, M. (eds.) CPP 2013. LNCS, vol. 8307, pp. 82–97. Springer, Cham (2013).  https://doi.org/10.1007/978-3-319-03545-1_6CrossRefGoogle Scholar
  11. 11.
    Doczkal, C., Smolka, G.: Regular language representations in the constructive type theory of Coq. J. Autom. Reason. 61(1), 521–553 (2018).  https://doi.org/10.1007/s10817-018-9460-xMathSciNetCrossRefzbMATHGoogle Scholar
  12. 12.
    Emmi, M., Majumdar, R.: Decision problems for the verification of real-time software. In: Hespanha, J.P., Tiwari, A. (eds.) HSCC 2006. LNCS, vol. 3927, pp. 200–211. Springer, Heidelberg (2006).  https://doi.org/10.1007/11730637_17CrossRefGoogle Scholar
  13. 13.
    Firsov, D.: Certification of Context-Free Grammar Algorithms (2016)Google Scholar
  14. 14.
    Firsov, D., Uustalu, T.: Certified parsing of regular languages. In: Gonthier, G., Norrish, M. (eds.) CPP 2013. LNCS, vol. 8307, pp. 98–113. Springer, Cham (2013).  https://doi.org/10.1007/978-3-319-03545-1_7CrossRefzbMATHGoogle Scholar
  15. 15.
    Firsov, D., Uustalu, T.: Certified CYK parsing of context-free languages. J. Log. Algebraic Methods Program. 83(5–6), 459–468 (2014)MathSciNetCrossRefGoogle Scholar
  16. 16.
    Firsov, D., Uustalu, T.: Certified normalization of context-free grammars. In: Proceedings of the 2015 Conference on Certified Programs and Proofs, pp. 167–174. ACM (2015)Google Scholar
  17. 17.
    Grigorev, S., Ragozina, A.: Context-free path querying with structural representation of result. arXiv preprint arXiv:1612.08872 (2016)
  18. 18.
    Gross, J., Chlipala, A.: Parsing Parses A Pearl of (Dependently Typed) Programming and Proof (2015)Google Scholar
  19. 19.
    Hellings, J.: Conjunctive Context-Free Path Queries (2014)Google Scholar
  20. 20.
    Hellings, J.: Querying for paths in graphs using context-free path queries. arXiv preprint arXiv:1502.02242 (2015)
  21. 21.
    Hofmann, J.: Verified Algorithms for Context-Free Grammars in Coq (2016)Google Scholar
  22. 22.
    Kaiser, J.O.: Constructive formalization of regular languages. Ph.D. thesis, Saarland University (2012)Google Scholar
  23. 23.
    Koschmieder, A., Leser, U.: Regular path queries on large graphs. In: Ailamaki, A., Bowers, S. (eds.) SSDBM 2012. LNCS, vol. 7338, pp. 177–194. Springer, Heidelberg (2012).  https://doi.org/10.1007/978-3-642-31235-9_12CrossRefGoogle Scholar
  24. 24.
    Lohrey, M.: Algorithmics on SLP-compressed strings: a survey. Groups Complex. Cryptol. 4, 241–299 (2012)MathSciNetCrossRefGoogle Scholar
  25. 25.
    Lu, Y., Shang, L., Xie, X., Xue, J.: An incremental points-to analysis with CFL-reachability. In: Jhala, R., De Bosschere, K. (eds.) CC 2013. LNCS, vol. 7791, pp. 61–81. Springer, Heidelberg (2013).  https://doi.org/10.1007/978-3-642-37051-9_4CrossRefGoogle Scholar
  26. 26.
    Maneth, S., Peternek, F.: Grammar-based graph compression. Inf. Syst. 76, 19–45 (2018). http://www.sciencedirect.com/science/article/pii/S0306437917301680CrossRefGoogle Scholar
  27. 27.
    Nederhof, M.J., Satta, G.: Parsing non-recursive context-free grammars. In: Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, ACL 2002, pp. 112–119. Association for Computational Linguistics, Stroudsburg (2002).  https://doi.org/10.3115/1073083.1073104
  28. 28.
    Nederhof, M.J., Satta, G.: The language intersection problem for non-recursive context-free grammars. Inf. Comput. 192(2), 172–184 (2004). http://www.sciencedirect.com/science/article/pii/S0890540104000562MathSciNetCrossRefGoogle Scholar
  29. 29.
    Pratikakis, P., Foster, J.S., Hicks, M.: Existential label flow inference via CFL reachability. In: Yi, K. (ed.) SAS 2006. LNCS, vol. 4134, pp. 88–106. Springer, Heidelberg (2006).  https://doi.org/10.1007/11823230_7CrossRefGoogle Scholar
  30. 30.
    Ramos, M.V.M., de Queiroz, R.J.G.B.: Formalization of closure properties for context-free grammars. CoRR abs/1506.03428 (2015). http://arxiv.org/abs/1506.03428
  31. 31.
    Ramos, M.V.M., de Queiroz, R.J.G.B., Moreira, N., Almeida, J.C.B.: Formalization of the pumping lemma for context-free languages. CoRR abs/1510.04748 (2015). http://arxiv.org/abs/1510.04748
  32. 32.
    Ramos, M.V.M., de Queiroz, R.J.G.B., Moreira, N., Almeida, J.C.B.: On the formalization of some results of context-free language theory. In: Väänänen, J., Hirvonen, Å., de Queiroz, R. (eds.) WoLLIC 2016. LNCS, vol. 9803, pp. 338–357. Springer, Heidelberg (2016).  https://doi.org/10.1007/978-3-662-52921-8_21CrossRefzbMATHGoogle Scholar
  33. 33.
    Ramos, M.V., Almeida, J.C.B., de Queiroz, R.J., Moreira, N.: Some applications of the formalization of the pumping lemma for context-free languages. In: Proceedings of the 13th Workshop on Logical and Semantic Frameworks with Applications, pp. 43–56 (2018)Google Scholar
  34. 34.
    Ramos, M.V., de Queiroz, R.J.: Formalization of simplification for context-free grammars. arXiv preprint arXiv:1509.02032 (2015)
  35. 35.
    Rehof, J., Fähndrich, M.: Type-base flow analysis: from polymorphic subtyping to CFL-reachability. ACM SIGPLAN Not. 36(3), 54–66 (2001)CrossRefGoogle Scholar
  36. 36.
    Reps, T., Horwitz, S., Sagiv, M.: Precise interprocedural dataflow analysis via graph reachability. In: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1995, pp. 49–61. ACM, New York (1995).  https://doi.org/10.1145/199448.199462
  37. 37.
    Scott, E., Johnstone, A.: GLL parsing. Electron. Notes Theor. Comput. Sci. 253(7), 177–189 (2010)CrossRefGoogle Scholar
  38. 38.
    Seki, H., Matsumura, T., Fujii, M., Kasami, T.: On multiple context-free grammars. Theor. Comput. Sci. 88(2), 191–229 (1991). http://www.sciencedirect.com/science/article/pii/030439759190374BMathSciNetCrossRefGoogle Scholar
  39. 39.
    Vardoulakis, D., Shivers, O.: CFA2: a context-free approach to control-flow analysis. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 570–589. Springer, Heidelberg (2010).  https://doi.org/10.1007/978-3-642-11957-6_30CrossRefGoogle Scholar
  40. 40.
    Yan, D., Xu, G., Rountev, A.: Demand-driven context-sensitive alias analysis for Java. In: Proceedings of the 2011 International Symposium on Software Testing and Analysis, ISSTA 2011, pp. 155–165. ACM, New York (2011).  https://doi.org/10.1145/2001420.2001440
  41. 41.
    Zhang, Q., Su, Z.: Context-sensitive data-dependence analysis via linear conjunctive language reachability. SIGPLAN Not. 52(1), 344–358 (2017).  https://doi.org/10.1145/3093333.3009848CrossRefzbMATHGoogle Scholar
  42. 42.
    Zhang, X., Feng, Z., Wang, X., Rao, G., Wu, W.: Context-free path queries on RDF graphs. In: Groth, P., et al. (eds.) ISWC 2016. LNCS, vol. 9981, pp. 632–648. Springer, Cham (2016).  https://doi.org/10.1007/978-3-319-46523-4_38CrossRefGoogle Scholar

Copyright information

© Springer-Verlag GmbH Germany, part of Springer Nature 2019

Authors and Affiliations

  1. 1.Max Planck Institute for Software Systems (MPI-SWS)SaarbrückenGermany
  2. 2.St. Petersburg Electrotechnical University “LETI”St. PetersburgRussia
  3. 3.St. Petersburg State UniversitySt. PetersburgRussia
  4. 4.JetBrains ResearchSt. PetersburgRussia

Personalised recommendations