Skip to main content

Bar-Hillel Theorem Mechanization in Coq

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNTCS,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.

The research was supported by the Russian Science Foundation, grant № 18-11-00100.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Notes

  1. 1.

    Jana Hofmann, Verified Algorithms for Context-Free Grammars in Coq. Related sources in Coq: https://www.ps.uni-saarland.de/~hofmann/bachelor/coq_src.zip. Documentation: https://www.ps.uni-saarland.de/~hofmann/bachelor/coq/toc.html. Access date: 10.10.2018.

References

  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/S0022000099916276

    Article  MathSciNet  Google Scholar 

  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. Bar-Hillel, Y., Perles, M., Shamir, E.: On formal properties of simple phrase structure grammars. Sprachtypologie und Universalienforschung 14, 143–172 (1961)

    MathSciNet  MATH  Google Scholar 

  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 2010

    Google Scholar 

  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_12

    Chapter  Google Scholar 

  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_11

    Chapter  Google Scholar 

  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_11

    Chapter  MATH  Google Scholar 

  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. 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_10

    Chapter  Google Scholar 

  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_6

    Chapter  Google Scholar 

  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-x

    Article  MathSciNet  MATH  Google Scholar 

  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_17

    Chapter  Google Scholar 

  13. Firsov, D.: Certification of Context-Free Grammar Algorithms (2016)

    Google Scholar 

  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_7

    Chapter  MATH  Google Scholar 

  15. Firsov, D., Uustalu, T.: Certified CYK parsing of context-free languages. J. Log. Algebraic Methods Program. 83(5–6), 459–468 (2014)

    Article  MathSciNet  Google Scholar 

  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. Grigorev, S., Ragozina, A.: Context-free path querying with structural representation of result. arXiv preprint arXiv:1612.08872 (2016)

  18. Gross, J., Chlipala, A.: Parsing Parses A Pearl of (Dependently Typed) Programming and Proof (2015)

    Google Scholar 

  19. Hellings, J.: Conjunctive Context-Free Path Queries (2014)

    Google Scholar 

  20. Hellings, J.: Querying for paths in graphs using context-free path queries. arXiv preprint arXiv:1502.02242 (2015)

  21. Hofmann, J.: Verified Algorithms for Context-Free Grammars in Coq (2016)

    Google Scholar 

  22. Kaiser, J.O.: Constructive formalization of regular languages. Ph.D. thesis, Saarland University (2012)

    Google Scholar 

  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_12

    Chapter  Google Scholar 

  24. Lohrey, M.: Algorithmics on SLP-compressed strings: a survey. Groups Complex. Cryptol. 4, 241–299 (2012)

    Article  MathSciNet  Google Scholar 

  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_4

    Chapter  Google Scholar 

  26. Maneth, S., Peternek, F.: Grammar-based graph compression. Inf. Syst. 76, 19–45 (2018). http://www.sciencedirect.com/science/article/pii/S0306437917301680

    Article  Google Scholar 

  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. 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/S0890540104000562

    Article  MathSciNet  Google Scholar 

  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_7

    Chapter  Google Scholar 

  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. 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. 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_21

    Chapter  MATH  Google Scholar 

  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. Ramos, M.V., de Queiroz, R.J.: Formalization of simplification for context-free grammars. arXiv preprint arXiv:1509.02032 (2015)

  35. Rehof, J., Fähndrich, M.: Type-base flow analysis: from polymorphic subtyping to CFL-reachability. ACM SIGPLAN Not. 36(3), 54–66 (2001)

    Article  Google Scholar 

  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. Scott, E., Johnstone, A.: GLL parsing. Electron. Notes Theor. Comput. Sci. 253(7), 177–189 (2010)

    Article  Google Scholar 

  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/030439759190374B

    Article  MathSciNet  Google Scholar 

  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_30

    Chapter  Google Scholar 

  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. 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.3009848

    Article  MATH  Google Scholar 

  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_38

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sergey Bozhko .

Editor information

Editors and Affiliations

A   Coq Listing

A   Coq Listing

This listing contains main theorems and definitions from our work.

figure a
figure b
figure c

Rights and permissions

Reprints and permissions

Copyright information

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

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Bozhko, S., Khatbullina, L., Grigorev, S. (2019). Bar-Hillel Theorem Mechanization in Coq. In: Iemhoff, R., Moortgat, M., de Queiroz, R. (eds) Logic, Language, Information, and Computation. WoLLIC 2019. Lecture Notes in Computer Science(), vol 11541. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-59533-6_17

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-59533-6_17

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-662-59532-9

  • Online ISBN: 978-3-662-59533-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics