Denotation-based Compositional Compiler Verification (2404.17297v2)
Abstract: A desired but challenging property of compiler verification is compositionality in the sense that the compilation correctness of a program can be deduced from that of its substructures ranging from statements, functions, and modules incrementally. Previously proposed approaches have devoted extensive effort to module-level compositionality based on small-step semantics and simulation theories. This paper proposes a novel compiler verification framework based on denotational semantics for better compositionality. Specifically, our denotational semantics is defined by semantic functions that map a syntactic component to a semantic domain composed of multiple behavioral \emph{sets}, and compiler correctness is defined by the behavioral refinement between semantic domains of the source and the target programs. Therefore, when proving compiler correctness, we can extensively leverage the algebraic properties of sets. Another important contribution is that our formalization of denotational semantics captures the full meaning of a program and bridges the gap between those based on conventional powerdomains and what realistic compiler verification actually needs. We demonstrate our denotation-based framework viable and practical by applying it to the verification of the front-end of CompCert and showing that the compositionality from the compilation correctness of sub-statements to statements, from functions to modules, and from modules to the whole program (i.e., module-level compositionality) can be achieved similarly.
- Krzysztof R Apt and Gordon D Plotkin. 1981. A Cook’s tour of countable nondeterminism. In International Colloquium on Automata, Languages, and Programming. Springer, 479–494.
- Ralph-Johan Back. 1983. A Continuous Semantics for Unbounded Nondeterminism. Theor. Comput. Sci. 23 (1983), 187–210. https://doi.org/10.1016/0304-3975(83)90055-5
- An Assertion-Based Program Logic for Probabilistic Programs. In Programming Languages and Systems - 27th European Symposium on Programming, ESOP 2018, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2018, Thessaloniki, Greece, April 14-20, 2018, Proceedings (Lecture Notes in Computer Science, Vol. 10801), Amal Ahmed (Ed.). Springer, 117–144. https://doi.org/10.1007/978-3-319-89884-1_5
- Verified Compilation for Shared-Memory C. In Programming Languages and Systems - 23rd European Symposium on Programming, ESOP 2014, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2014, Grenoble, France, April 5-13, 2014, Proceedings (Lecture Notes in Computer Science, Vol. 8410), Zhong Shao (Ed.). Springer, 107–127. https://doi.org/10.1007/978-3-642-54833-8_7
- Formal Verification of a C Compiler Front-End. In FM 2006: Formal Methods, 14th International Symposium on Formal Methods, Hamilton, Canada, August 21-27, 2006, Proceedings (Lecture Notes in Computer Science, Vol. 4085), Jayadev Misra, Tobias Nipkow, and Emil Sekerinski (Eds.). Springer, 460–475. https://doi.org/10.1007/11813040_31
- Semantics of Nondeterministic and Noncontinuous Constructs. In Program Construction, International Summer School, July 26 - August 6, 1978, Marktoberdorf, Germany (Lecture Notes in Computer Science, Vol. 69), Friedrich L. Bauer and Manfred Broy (Eds.). Springer, 553–592. https://doi.org/10.1007/BFb0014683
- Semantics of Nondeterminism, Concurrency, and Communication. J. Comput. Syst. Sci. 19, 3 (1979), 290–308. https://doi.org/10.1016/0022-0000(79)90006-0
- Deep Specifications and Certified Abstraction Layers. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15-17, 2015, Sriram K. Rajamani and David Walker (Eds.). ACM, 595–608. https://doi.org/10.1145/2676726.2676975
- Towards certified separate compilation for concurrent programs. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2019, Phoenix, AZ, USA, June 22-26, 2019, Kathryn S. McKinley and Kathleen Fisher (Eds.). ACM, 111–125. https://doi.org/10.1145/3314221.3314595
- Lightweight verification of separate compilation. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2016, St. Petersburg, FL, USA, January 20 - 22, 2016, Rastislav Bodík and Rupak Majumdar (Eds.). ACM, 178–190. https://doi.org/10.1145/2837614.2837642
- Jérémie Koenig and Zhong Shao. 2021. CompCertO: compiling certified open C components. In PLDI ’21: 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation, Virtual Event, Canada, June 20-25, 2021, Stephen N. Freund and Eran Yahav (Eds.). ACM, 1095–1109. https://doi.org/10.1145/3453483.3454097
- Paul R. Kosinki. 1978. A Straightforward Denotational Semantics for Non-Determinant Data Flow Programs. In Conference Record of the Fifth Annual ACM Symposium on Principles of Programming Languages, Tucson, Arizona, USA, January 1978, Alfred V. Aho, Stephen N. Zilles, and Thomas G. Szymanski (Eds.). ACM Press, 214–221. https://doi.org/10.1145/512760.512783
- Dexter Kozen. 1994. A Completeness Theorem for Kleene Algebras and the Algebra of Regular Events. Inf. Comput. 110, 2 (1994), 366–390. https://doi.org/10.1006/INCO.1994.1037
- Dexter Kozen and Maria-Christina Patron. 2000. Certification of Compiler Optimizations Using Kleene Algebra with Tests. In Computational Logic - CL 2000, First International Conference, London, UK, 24-28 July, 2000, Proceedings (Lecture Notes in Computer Science, Vol. 1861), John W. Lloyd, Verónica Dahl, Ulrich Furbach, Manfred Kerber, Kung-Kiu Lau, Catuscia Palamidessi, Luís Moniz Pereira, Yehoshua Sagiv, and Peter J. Stuckey (Eds.). Springer, 568–582. https://doi.org/10.1007/3-540-44957-4_38
- Dexter Kozen and Frederick Smith. 1996. Kleene Algebra with Tests: Completeness and Decidability. In Computer Science Logic, 10th International Workshop, CSL ’96, Annual Conference of the EACSL, Utrecht, The Netherlands, September 21-27, 1996, Selected Papers (Lecture Notes in Computer Science, Vol. 1258), Dirk van Dalen and Marc Bezem (Eds.). Springer, 244–259. https://doi.org/10.1007/3-540-63172-0_43
- CakeML: a verified implementation of ML. In The 41st Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’14, San Diego, CA, USA, January 20-21, 2014, Suresh Jagannathan and Peter Sewell (Eds.). ACM, 179–192. https://doi.org/10.1145/2535838.2535841
- Xavier Leroy. 2009a. Formal verification of a realistic compiler. Commun. ACM 52, 7 (2009), 107–115. https://doi.org/10.1145/1538788.1538814
- Xavier Leroy. 2009b. A Formally Verified Compiler Back-end. J. Autom. Reason. 43, 4 (2009), 363–446. https://doi.org/10.1007/s10817-009-9155-4
- David Michael Ritchie Park. 1979. On the Semantics of Fair Parallelism. In Abstract Software Specifications, 1979 Copenhagen Winter School, January 22 - February 2, 1979, Proceedings (Lecture Notes in Computer Science, Vol. 86), Dines Bjørner (Ed.). Springer, 504–526. https://doi.org/10.1007/3-540-10007-5_47
- Daniel Patterson and Amal Ahmed. 2019. The next 700 compiler correctness theorems (functional pearl). Proc. ACM Program. Lang. 3, ICFP (2019), 85:1–85:29. https://doi.org/10.1145/3341689
- Gordon Plotkin. 1983. Domains. University of Edinburgh (1983).
- Gordon D. Plotkin. 1976. A Powerdomain Construction. SIAM J. Comput. 5, 3 (1976), 452–487. https://doi.org/10.1137/0205035
- A Compositional Semantics for Verified Separate Compilation and Linking. In Proceedings of the 2015 Conference on Certified Programs and Proofs, CPP 2015, Mumbai, India, January 15-17, 2015, Xavier Leroy and Alwen Tiu (Eds.). ACM, 3–14. https://doi.org/10.1145/2676724.2693167
- Dana Scott. 1970. Outline of a mathematical theory of computation. Oxford University Computing Laboratory, Programming Research Group Oxford.
- Dana S Scott and Christopher Strachey. 1971. Toward a mathematical semantics for computer languages. Vol. 1. Oxford University Computing Laboratory, Programming Research Group Oxford.
- Michael B. Smyth. 1978. Power Domains. J. Comput. Syst. Sci. 16, 1 (1978), 23–36. https://doi.org/10.1016/0022-0000(78)90048-X
- CompCertM: CompCert with C-assembly linking and lightweight modular verification. Proc. ACM Program. Lang. 4, POPL (2020), 23:1–23:31. https://doi.org/10.1145/3371091
- Compositional CompCert. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2015, Mumbai, India, January 15-17, 2015, Sriram K. Rajamani and David Walker (Eds.). ACM, 275–287. https://doi.org/10.1145/2676726.2676985
- A Denotational Semantics for Low-Level Probabilistic Programs with Nondeterminism. In Proceedings of the Thirty-Fifth Conference on the Mathematical Foundations of Programming Semantics, MFPS 2019, London, UK, June 4-7, 2019 (Electronic Notes in Theoretical Computer Science, Vol. 347), Barbara König (Ed.). Elsevier, 303–324. https://doi.org/10.1016/J.ENTCS.2019.09.016
- An abstract stack based approach to verified compositional compilation to machine code. Proc. ACM Program. Lang. 3, POPL (2019), 62:1–62:30. https://doi.org/10.1145/3290375
- Glynn Winskel. 1985. On Powerdomains and Modality. Theor. Comput. Sci. 36 (1985), 127–137. https://doi.org/10.1016/0304-3975(85)90037-4
- Interaction trees: representing recursive and impure programs in Coq. Proc. ACM Program. Lang. 4, POPL (2020), 51:1–51:32. https://doi.org/10.1145/3371119
- A Bottom-Up Approach to a Unified Semantic Interface for Verified Compositional Compilation. CoRR abs/2302.12990 (2023). https://doi.org/10.48550/arXiv.2302.12990 arXiv:2302.12990