Skip to main content

Interactive Matching Logic Proofs in Coq

  • Conference paper
  • First Online:
Theoretical Aspects of Computing – ICTAC 2023 (ICTAC 2023)

Abstract

Matching logic (ML) is a formalism for specifying and reasoning about mathematical structures by means of patterns and pattern matching. Previously, it has been used to capture a number of other logics, e.g., separation logic with recursive definitions and linear temporal logic. ML has also been formalized in the Coq Proof Assistant, and the soundness of its Hilbert-style proof system has been mechanized.

However, using a Hilbert-style system for interactive reasoning is challenging—even more so in ML, which lacks a general deduction theorem. Therefore, we propose a single-conclusion sequent calculus for ML that is more amenable to interactive proving. Based on this sequent calculus, we implement a proof mode for interactive reasoning in ML, which significantly simplifies the construction of ML proofs in Coq. The proof mode is a mechanism for displaying intermediate proof states and an extensible set of proof tactics that implement the rules of the sequent calculus. We evaluate our proof mode on a collection of examples, showing a substantial improvement in proof script size and readability.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 59.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 79.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

Institutional subscriptions

Notes

  1. 1.

    This is done without modifications to Coq. In particular, MLPM is not a Coq plugin.

  2. 2.

    We expand on the preliminary implementation reported in [4].

  3. 3.

    [1, : , , , ].

  4. 4.

    We plan to extend \(\vdash _{\mathcal {S}}\) with fixpoint and frame reasoning capabilities in the future.

  5. 5.

    The application context of the framing rules are decomposed into two separate rules in [4].

  6. 6.

    examples/02_proofmode/theories/tutorial.v.

  7. 7.

    In the implementation we allow only (co-)finite sets of variables for the components of a constraint.

References

  1. Matching logic formalization. https://github.com/harp-project/AML-Formalization/releases/tag/v1.0.15. Accessed 27 June 2023

  2. Investigations into logical deduction. In: Szabo, M. (ed.) The Collected Papers of Gerhard Gentzen. Studies in Logic and the Foundations of Mathematics. Elsevier (1969). https://doi.org/10.1016/S0049-237X(08)70822-X

  3. Appel, A.W., Blazy, S.: Separation logic for small-step Cminor. In: Schneider, K., Brandt, J. (eds.) TPHOLs 2007. LNCS, vol. 4732, pp. 5–21. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-74591-4_3

    Chapter  Google Scholar 

  4. Bereczky, P., Chen, X., Horpácsi, D., Peña, L., Tušil, J.: Mechanizing matching logic in Coq. Electronic Proceedings in Theoretical Computer Science (2022). https://doi.org/10.4204/eptcs.369.2

  5. Bohrer, R., Rahli, V., Vukotic, I., Völp, M., Platzer, A.: Formally verified differential dynamic logic. In: Proceedings of the 6th ACM SIGPLAN Conference on Certified Programs and Proofs, CPP 2017. Association for Computing Machinery (2017). https://doi.org/10.1145/3018610.3018616

  6. Bornat, R., Sufrin, B.: Animating formal proof at the surface: the Jape Proof Calculator. Comput. J. (1999). https://doi.org/10.1093/comjnl/42.3.177

  7. Bradfield, J., Stirling, C.: Modal mu-calculi. In: Handbook of Modal Logic. Studies in Logic and Practical Reasoning. Elsevier (2007). https://doi.org/10.1016/S1570-2464(07)80015-2

  8. Charguéraud, A.: The locally nameless representation. J. Autom. Reason. (2012). https://doi.org/10.1007/s10817-011-9225-2

  9. Chen, X., Lin, Z., Trinh, M.-T., Roşu, G.: Towards a trustworthy semantics-based language framework via proof generation. In: Silva, A., Leino, K.R.M. (eds.) CAV 2021. LNCS, vol. 12760, pp. 477–499. Springer, Cham (2021). https://doi.org/10.1007/978-3-030-81688-9_23

    Chapter  Google Scholar 

  10. Chen, X., Lucanu, D., Rosu, G.: Capturing constrained constructor patterns in matching logic. J. Log. Algebraic Methods Program. (2023). https://doi.org/10.1016/j.jlamp.2022.100810

  11. Chen, X., Lucanu, D., Roşu, G.: Matching logic explained. J. Logical Algebraic Methods Program. (2021). https://doi.org/10.1016/j.jlamp.2021.100638

  12. Chen, X., Roşu, G.: Applicative matching logic: semantics of K. Technical report, University of Illinois at Urbana-Champaign (2019). http://hdl.handle.net/2142/104616

  13. Chen, X., Roşu, G.: Matching \(\mu \)-logic. In: 34th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2019, Vancouver, BC, Canada, 24–27 June 2019. IEEE (2019). https://doi.org/10.1109/LICS.2019.8785675

  14. Chen, X., Roşu, G.: Matching mu-logic. Technical report, University of Illinois at Urbana-Champaign (2019). http://hdl.handle.net/2142/102281. Accessed 16 Feb 2023

  15. Cheney, J., Fernandez, M.: Nominal matching logic. In: Proceedings of the 24th International Symposium on Principles and Practice of Declarative Programming, PPDP 2022. Association for Computing Machinery (2022). https://doi.org/10.1145/3551357.3551375

  16. Coupet-Grimal, S.: An axiomatization of linear temporal logic in the Calculus of Inductive Constructions. J. Log. Comput. (2003). https://doi.org/10.1093/logcom/13.6.801

  17. Dyckhoff, R.: Contraction-free sequent calculi for intuitionistic logic. J. Symb. Logic (1992). https://doi.org/10.2307/2275431

  18. Fitting, M.: First-Order Logic and Automated Theorem Proving. Springer, New York (1996). https://doi.org/10.1007/978-1-4612-2360-3

    Book  MATH  Google Scholar 

  19. Krebbers, R., et al.: MoSeL: a general, extensible modal framework for interactive proofs in separation logic. Proc. ACM Program. Lang. (2018). https://doi.org/10.1145/3236772

    Article  Google Scholar 

  20. Krebbers, R., Timany, A., Birkedal, L.: Interactive proofs in higher-order concurrent separation logic. In: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, 18–20 January 2017. ACM (2017). https://doi.org/10.1145/3009837.3009855

  21. Lungu, A.I., Lucanu, D.: A matching logic foundation for Alk. In: Seidl, H., Liu, Z., Pasareanu, C.S. (eds.) ICTAC 2022. LNCS, vol. 13572, pp. 290–304. Springer, Cham (2022). https://doi.org/10.1007/978-3-031-17715-6_19

    Chapter  Google Scholar 

  22. McCreight, A.: Practical tactics for separation logic. In: Berghofer, S., Nipkow, T., Urban, C., Wenzel, M. (eds.) TPHOLs 2009. LNCS, vol. 5674, pp. 343–358. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-03359-9_24

    Chapter  Google Scholar 

  23. Megill, N., Wheeler, D.A.: Metamath: a computer language for mathematical proofs. http://us.metamath.org. Accessed 16 Feb 2023

  24. Michaelis, J., Nipkow, T.: Formalized proof systems for propositional logic. In: 23rd International Conference on Types for Proofs and Programs, TYPES 2017, Budapest, Hungary, 29 May–1 June 2017. LIPIcs, Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2017). https://doi.org/10.4230/LIPIcs.TYPES.2017.5

  25. Pelletier, F.J., Hazen, A.: Natural deduction systems in logic. In: The Stanford Encyclopedia of Philosophy. Metaphysics Research Lab, Stanford University (2022)

    Google Scholar 

  26. Power, J.F., Webster, C.: Working with linear logic in Coq (1999). https://mural.maynoothuniversity.ie/6461/1/JP-Working-Linear-Logic.pdf. Accessed 16 Feb 2023

  27. Roşu, G.: Matching logic. Log. Methods Comput. Sci. (2017). https://doi.org/10.23638/LMCS-13(4:28)2017

  28. Stefanescu, A., Park, D., Yuwen, S., Li, Y., Rosu, G.: Semantics-based program verifiers for all languages. In: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, Part of SPLASH 2016, Amsterdam, The Netherlands, 30 October–4 November 2016. ACM (2016). https://doi.org/10.1145/2983990.2984027

  29. The Coq Development Team: The coq proof assistant (2022). https://doi.org/10.5281/zenodo.7313584

  30. Wang, S.B., Dong, W.Y.: Matching logic for concurrent programs based on rely/guarantee and abstract patterns. Int. J. Softw. Eng. Knowl. Eng. (2022)

    Google Scholar 

  31. Wiedijk, F.: Encoding the HOL Light logic in Coq (2007). https://www.cs.ru.nl/~freek/notes/holl2coq.pdf. Accessed 30 June 2023

Download references

Acknowledgements

We warmly thank Runtime Verification Inc. for their generous funding support.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Jan Tušil .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Tušil, J., Bereczky, P., Horpácsi, D. (2023). Interactive Matching Logic Proofs in Coq. In: Ábrahám, E., Dubslaff, C., Tarifa, S.L.T. (eds) Theoretical Aspects of Computing – ICTAC 2023. ICTAC 2023. Lecture Notes in Computer Science, vol 14446. Springer, Cham. https://doi.org/10.1007/978-3-031-47963-2_10

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-47963-2_10

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-47962-5

  • Online ISBN: 978-3-031-47963-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics