Hostname: page-component-8448b6f56d-dnltx Total loading time: 0 Render date: 2024-04-18T20:20:34.527Z Has data issue: false hasContentIssue false

Mechanizing proofs with logical relations – Kripke-style

Published online by Cambridge University Press:  02 August 2018

ANDREW CAVE
Affiliation:
School of Computer Science, McGill University, Montreal, Canada Email: acave1@cs.mcgill.ca, bpientka@cs.mcgill.ca
BRIGITTE PIENTKA
Affiliation:
School of Computer Science, McGill University, Montreal, Canada Email: acave1@cs.mcgill.ca, bpientka@cs.mcgill.ca

Abstract

Proofs with logical relations play a key role to establish rich properties such as normalization or contextual equivalence. They are also challenging to mechanize. In this paper, we describe two case studies using the proof environment Beluga: First, we explain the mechanization of the weak normalization proof for the simply typed lambda-calculus; second, we outline how to mechanize the completeness proof of algorithmic equality for simply typed lambda-terms where we reason about logically equivalent terms. The development of these proofs in Beluga relies on three key ingredients: (1) we encode lambda-terms together with their typing rules, operational semantics, algorithmic and declarative equality using higher order abstract syntax (HOAS) thereby avoiding the need to manipulate and deal with binders, renaming and substitutions, (2) we take advantage of Beluga's support for representing derivations that depend on assumptions and first-class contexts to directly state inductive properties such as logical relations and inductive proofs, (3) we exploit Beluga's rich equational theory for simultaneous substitutions; as a consequence, users do not need to establish and subsequently use substitution properties, and proofs are not cluttered with references to them. We believe these examples demonstrate that Beluga provides the right level of abstractions and primitives to mechanize challenging proofs using HOAS encodings. It also may serve as a valuable benchmark for other proof environments.

Type
Paper
Copyright
Copyright © Cambridge University Press 2018 

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Abel, A. and Scherer, G. (2012). On irrelevance and algorithmic equality in predicative type theory. Logical Methods in Computer Science 8 (1) 136. TYPES'10 special issue.Google Scholar
Altenkirch, T. (1993). A formalization of the strong normalization proof for system F in LEGO. In: Bezem, M. and Groote, J. F. (eds.) International Conference on Typed Lambda Calculi and Applications (TLCA '93), Lecture Notes in Computer Science, vol. 664, Springer, 1328.Google Scholar
Aydemir, B., Bohannon, A., Fairbairn, M., Foster, J., Pierce, B., Sewell, P., Vytiniotis, D., Washburn, G., Weirich, S. and Zdancewic, S. (2005). Mechanized metatheory for the masses: The POPLmark challenge. In: Hurd, J. and Melham, T. F. (eds.) Proceedings of the 18th International Conference on Theorem Proving in Higher Order Logics (TPHOLs), Lecture Notes in Computer Science, vol. 3603, Springer, 5065.Google Scholar
Benton, N., Hur, C., Kennedy, A. and McBride, C. (2012). Strongly typed term representations in coq. Journal of Automated Reasoning 49 (2) 141159.Google Scholar
Berardi, S. (1990). Girard normalization proof in LEGO. In: Proceedings of the 1st Workshop on Logical Frameworks 67–78.Google Scholar
Cave, A. and Pientka, B. (2012). Programming with binders and indexed data-types. In: Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'12), ACM Press, 413–424.Google Scholar
Cave, A. and Pientka, B. (2013). First-class substitutions in contextual type theory. In: Proceedings of the 8th ACM SIGPLAN International Workshop on Logical Frameworks and Meta-Languages: Theory and Practice (LFMTP'13), ACM Press, 15–24.Google Scholar
Cave, A. and Pientka, B. (2015). A case study on logical relations using contextual types. In: Cervesato, I. and Chaudhuri, K. (eds.) Proceedings of the 10th International Workshop on Logical Frameworks and Meta-Languages: Theory and Practice (LFMTP'15), Electronic Proceedings in Theoretical Computer Science (EPTCS), 1833.Google Scholar
Coquand, C. (1992). A proof of normalization for simply typed lambda calculus writing in ALF. In: Informal Proceedings of Workshop on Types for Proofs and Programs, Dept. of Computing Science, Chalmers Univ. of Technology and Göteborg Univ, 80–87.Google Scholar
Crary, K. (2005). Logical relations and a case study in equivalence checking. In: Pierce, B. C. (ed.) Advanced Topics in Types and Programming Languages, The MIT Press.Google Scholar
Doczkal, C. and Schwinghammer, J. (2009). Formalizing a strong normalization proof for Moggi's computational metalanguage: A case study in Isabelle/HOL-nominal. In: Proceedings of the 4th International Workshop on Logical Frameworks and Meta-Languages: Theory and Practice (LFMTP'09), ACM, 57–63.Google Scholar
Felty, A. and Momigliano, A. (2012). Hybrid: A definitional two-level approach to reasoning with higher-order abstract syntax. Journal of Automated Reasoning 48 (1) 43105.Google Scholar
Felty, A.F., Momigliano, A. and Pientka, B. (2017). Benchmarks for reasoning with syntax trees containing binders and contexts of assumptions. Mathematical Structures in Computer Science.Google Scholar
Felty, A.P., Momigliano, A. and Pientka, B. (2015). The next 700 challenge problems for reasoning with higher-order abstract syntax representations: Part 2 - a survey. Journal of Automated Reasoning 55 (4) 307372.Google Scholar
Felty, A.P. and Pientka, B. (2010). Reasoning with higher-order abstract syntax and contexts: A comparison. In: Kaufmann, M. and Paulson, L. C. (eds.) International Conference on Interactive Theorem Proving, Lecture Notes in Computer Science, vol. 6172, Springer, 227242.Google Scholar
Ferreira, F. and Pientka, B. (2014). Bidirectional elaboration of dependently typed languages. In: Proceedings of the 16th International Symposium on Principles and Practice of Declarative Programming (PPDP'14), ACM, 161–174.Google Scholar
Gacek, A. (2008). The Abella interactive theorem prover (system description). In: Proceedings of the 4th International Joint Conference on Automated Reasoning, Lecture Notes in Artificial Intelligence, vol. 5195, Springer, 154–161.Google Scholar
Gacek, A., Miller, D. and Nadathur, G. (2008). Combining generic judgments with recursive definitions. In: Pfenning, F. (ed.) Proceedings of the 23rd Symposium on Logic in Computer Science, IEEE Computer Society Press, 33–44.Google Scholar
Gacek, A., Miller, D. and Nadathur, G. (2009). Reasoning in Abella about structural operational semantics specifications. In: Proceedings of the International Workshop on Logical Frameworks and Metalanguages: Theory and Practice (LFMTP 2008), Electronic Notes in Theoretical Computer Science (ENTCS), vol. 228, Elsevier, 85–100.Google Scholar
Girard, J.-Y., Lafont, Y. and Tayor, P. (1990). Proofs and Types, Cambridge University Press.Google Scholar
Harper, R., Honsell, F. and Plotkin, G. (1993). A framework for defining logics. Journal of the ACM 40 (1) 143184.Google Scholar
Harper, R. and Pfenning, F. (2005). On equivalence and canonical forms in the LF type theory. ACM Transactions on Computational Logic 6 (1) 61101.Google Scholar
Jacob-Rao, R., Pientka, B. and Thibodeau, D. (2018). Index-stratified types. In: Kirchner, H. (ed.) Proceedings of the 3rd International Conference on Formal Structures for Computation and Deduction (FSCD), Leibniz International Proceedings in Informatics (LIPIcs) of Schloss Dagstuhl.Google Scholar
Kaiser, J., Pientka, B. and Smolka, G. (2017). Relating system F and λ2: A case study in Coq, Abella and Beluga. In: Miller, D. (ed.) Proceedings of the 2nd International Conference on Formal Structures for Computation and Deduction (FSCD), Leibniz International Proceedings in Informatics (LIPIcs) of Schloss Dagstuhl, 21:1–21:19.Google Scholar
Nanevski, A., Pfenning, F. and Pientka, B. (2008). Contextual modal type theory. ACM Transactions on Computational Logic 9 (3) 149.Google Scholar
Narboux, J. and Urban, C. (2008). Formalising in Nominal Isabelle Crary's completeness proof for equivalence checking. Electronic Notes in Theoretical Computer Science 196 318.Google Scholar
Öhmann, J. (2016). A logical relation for dependent type theory formalized in agda. Master's thesis, University of Gothenburg.Google Scholar
Pfenning, F. and Schürmann, C. (1999). System description: Twelf – A meta-logical framework for deductive systems. In: Ganzinger, H. (ed.) Proceedings of the 16th International Conference on Automated Deduction (CADE-16), Lecture Notes in Artificial Intelligence (LNAI), vol. 1632, Springer, 202–206.Google Scholar
Pientka, B. (2008). A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions. In Proceedings of the 35th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'08), ACM Press, 371–382.Google Scholar
Pientka, B. (2010). Beluga: Programming with dependent types, contextual data, and contexts. In: Blume, M., Kobayashi, N. and Vidal, G. (eds.) Proceedings of the 10th International Symposium on Functional and Logic Programming (FLOPS'10), Lecture Notes in Computer Science (LNCS), vol. 6009, Springer, 1–12.Google Scholar
Pientka, B. (2013). An insider's look at LF type reconstruction: Everything you (n)ever wanted to know. Journal of Functional Programming 1 137.Google Scholar
Pientka, B. (2015). Mechanizing Types and Programming Languages: A Companion, McGill University. Available at https://github.com/Beluga-lang/Meta.Google Scholar
Pientka, B. and Abel, A. (2015). Structural recursion over contextual objects. In: Altenkirch, T. (ed.) Proceedings of the 13th International Conference on Typed Lambda Calculi and Applications (TLCA'15), Leibniz International Proceedings in Informatics (LIPIcs) of Schloss Dagstuhl, 273–287.Google Scholar
Pientka, B. and Cave, A. (2015). Inductive Beluga: Programming proofs (system description). In: Felty, A. P. and Middeldorp, A. (eds.) Proceedings of the 25th International Conference on Automated Deduction (CADE-25), Lecture Notes in Computer Science (LNCS), vol. 9195, Springer, 272–281.Google Scholar
Pientka, B. and Dunfield, J. (2008). Programming with proofs and explicit contexts. In ACM SIGPLAN Symposium on Principles and Practice of Declarative Programming (PPDP'08), ACM Press, 163–173.Google Scholar
Pientka, B. and Dunfield, J. (2010). Beluga: A framework for programming and reasoning with deductive systems (system description). In: Giesl, J. and Haehnle, R. (eds.) Proceedings of the 5th International Joint Conference on Automated Reasoning (IJCAR'10), Lecture Notes in Artificial Intelligence (LNAI 6173), Springer, 15–21.Google Scholar
Pitts, A.M. (1997). Operationally based theories of program equivalence. In: Dybjer, P. and Pitts, A. M. (eds.) Semantics and Logics of Computation. New York, NY: Cambridge University Press.Google Scholar
Poswolsky, A.B. and Schürmann, C. (2008). Practical programming with higher-order encodings and dependent types. In: Proceedings of the 17th European Symposium on Programming (ESOP '08), Lecture Notes in Computer Science (LNCS), vol. 4960, Springer, 93–107.Google Scholar
Rabe, F. and Sojakova, K. (2013). Logical relations for a logical framework. ACM Transactions on Computational Logic 14 (4) 32.Google Scholar
Rasmussen, U. and Filinski, A. (2013). Structural logical relations with case analysis and equality reasoning. In: Proceedings of the 8th ACM SIGPLAN International Workshop on Logical Frameworks and Meta-languages: Theory and Practice (LFMTP'13), ACM Press, 43–54.Google Scholar
Schürmann, C. and Sarnat, J. (2008). Structural logical relations. In: Proceedings of the 23rd Annual Symposium on Logic in Computer Science (LICS), Pittsburgh, PA, USA: IEEE Computer Society, 69–80.Google Scholar
Tait, W. (1967). Intensional interpretations of functionals of finite type I. The Journal of Symbolic Logic 32 (2) 198212.Google Scholar
Thibodeau, D., Cave, A. and Pientka, B. (2016). Indexed codata. In: Garrigue, J., Keller, G. and Sumii, E. (eds.) Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP'16), ACM, pp. 351–363.Google Scholar
Urban, C., Cheney, J. and Berghofer, S. (2011). Mechanizing the metatheory of LF. ACM Transactions on Computational Logic 12 (2) 15.Google Scholar