A case study in programming coinductive proofs: Howe’s method

Bisimulation proofs play a central role in programming languages in establishing rich properties such as contextual equivalence. They are also challenging to mechanize, since they require a combination of inductive and coinductive reasoning on open terms. In this paper, we describe mechanizing the property that similarity in the call-by-name lambda calculus is a pre-congruence using Howe’s method in the Beluga formal reasoning system. The development relies on three key ingredients: (1) we give a higher order abstract syntax (HOAS) encoding of lambda terms together with their operational semantics as intrinsically typed terms, thereby avoiding not only the need to deal with binders, renaming and substitutions, but keeping all typing invariants implicit; (2) we take advantage of Beluga ’s support for representing open terms using built-in contexts and simultaneous substitutions: this allows us to directly state central definitions such as open simulation without resorting to the usual inductive closure operation and to encode very elegantly notoriously painful proofs such as the substitutivity of the Howe relation; (3) we exploit the possibility of reasoning by coinduction in Beluga ’s reasoning logic. The end result is succinct and elegant, thanks to the high-level abstractions and primitives Beluga provides. We believe that this mechanization is a significant example that illustrates Beluga ’s strength at mechanizing challenging (co)inductive proofs using HOAS encodings.

[1]  Amy P. Felty,et al.  Hybrid - A Definitional Two-Level Approach to Reasoning with Higher-Order Abstract Syntax , 2012, J. Autom. Reason..

[2]  Joachim Parrow,et al.  Psi-calculi in Isabelle , 2009, TPHOLs.

[3]  Frank Pfenning,et al.  System Description: Twelf - A Meta-Logical Framework for Deductive Systems , 1999, CADE.

[4]  Brigitte Pientka Verifying Termination and Reduction Properties about Higher-Order Logic Programs , 2005, Journal of Automated Reasoning.

[5]  Eduardo Giménez,et al.  Un calcul de constructions infinies et son application a la verification de systemes communicants , 1996 .

[6]  Conor McBride,et al.  Epigram: Practical Programming with Dependent Types , 2004, Advanced Functional Programming.

[7]  Brigitte Pientka,et al.  Structural Recursion over Contextual Objects , 2014 .

[8]  Conor McBride,et al.  Type-and-scope safe programs and their proofs , 2017, CPP.

[9]  Kaustuv Chaudhuri A two-level logic perspective on (simultaneous) substitutions , 2018, CPP.

[10]  Yann Régis-Gianas,et al.  Copattern matching and first-class observations in OCaml, with a macro , 2017, PPDP.

[11]  Brigitte Pientka A type-theoretic foundation for programming with higher-order abstract syntax and first-class substitutions , 2008, POPL '08.

[12]  Dale Miller,et al.  Foundational aspects of syntax , 1999, CSUR.

[13]  Dale Miller,et al.  A logic for reasoning with higher-order abstract syntax , 1997, Proceedings of Twelfth Annual IEEE Symposium on Logic in Computer Science.

[14]  Furio Honsell,et al.  pi-calculus in (Co)inductive-type theory , 2001, Theor. Comput. Sci..

[15]  Brigitte Pientka,et al.  Copatterns: programming infinite structures by observations , 2013, POPL.

[16]  Glynn Winskel,et al.  Relational Reasoning about Functions and Nondeterminism , 1999 .

[17]  Alberto Momigliano A supposedly fun thing i may have to do again: a HOAS encoding of Howe's method , 2012, LFMTP '12.

[18]  Gopalan Nadathur,et al.  A Higher-Order Abstract Syntax Approach to Verified Transformations on Functional Programs , 2015, ESOP.

[19]  Dan R. Ghica,et al.  Reasoning about Idealized ALGOL Using Regular Languages , 2000, ICALP.

[20]  Andrew Pitts,et al.  Semantics and Logics of Computation: Operationally-Based Theories of Program Equivalence , 1997 .

[21]  Ian Stark,et al.  Triangulating context lemmas , 2018, CPP.

[22]  Dale Miller,et al.  A proof theory for generic judgments , 2005, TOCL.

[23]  Joachim Parrow,et al.  Formalising the pi-Calculus Using Nominal Logic , 2007, FoSSaCS.

[24]  Brigitte Pientka,et al.  Beluga: A Framework for Programming and Reasoning with Deductive Systems (System Description) , 2010, IJCAR.

[25]  Samson Abramsky,et al.  A Domain Equation for Bisimulation , 1991, Inf. Comput..

[26]  Andreas Abel Type-Based Termination, Inflationary Fixed-Points, and Mixed Inductive-Coinductive Types , 2012, FICS.

[27]  Frank Pfenning,et al.  Contextual modal type theory , 2008, TOCL.

[28]  James Cheney,et al.  αCheck: A mechanized metatheory model checker* , 2017, Theory and Practice of Logic Programming.

[29]  Alberto Momigliano,et al.  Induction and Co-induction in Sequent Calculus , 2003, TYPES.

[30]  Brigitte Pientka,et al.  An insider's look at LF type reconstruction: everything you (n)ever wanted to know , 2013, J. Funct. Program..

[31]  Steven Schäfer,et al.  Autosubst 2: Towards Reasoning with Multi-Sorted de Bruijn Terms and Vector Substitutions , 2017 .

[32]  Gopalan Nadathur,et al.  The Bedwyr System for Model Checking over Syntactic Expressions , 2007, CADE.

[33]  Brigitte Pientka,et al.  Index-Stratified Types , 2018, FSCD.

[34]  Brigitte Pientka,et al.  Programming with proofs and explicit contexts , 2008, PPDP '08.

[35]  Daniel Hirschko A full formalisation of pi-calculus theory in the Calculus of Constructions , 1997 .

[36]  Alan Schmitt,et al.  HOπ in Coq , 2018, CPP.

[37]  Brigitte Pientka,et al.  Indexed codata types , 2016, ICFP.

[38]  Chung-Kil Hur,et al.  Strongly Typed Term Representations in Coq , 2011, Journal of Automated Reasoning.

[39]  Roy L. Crole,et al.  A Hybrid Encoding of Howe's Method for Establishing Congruence of Bisimilarity , 2002, Electron. Notes Theor. Comput. Sci..

[40]  Ian A. Mason,et al.  Formal Foundations of Operational Semantics , 2003, High. Order Symb. Comput..

[41]  Joachim Parrow,et al.  Higher-order psi-calculi , 2014, Math. Struct. Comput. Sci..

[42]  Brigitte Pientka,et al.  Programming with binders and indexed data-types , 2012, POPL '12.

[43]  Brigitte Pientka,et al.  Inductive Beluga: Programming Proofs , 2015, CADE.

[44]  Andrei Popescu,et al.  Foundational (Co)datatypes and (Co)recursion for Higher-Order Logic , 2017, FroCoS.

[45]  Gopalan Nadathur,et al.  Combining Generic Judgments with Recursive Definitions , 2008, 2008 23rd Annual IEEE Symposium on Logic in Computer Science.

[46]  Dale Miller,et al.  Proof search specifications of bisimulation and modal logics for the π-calculus , 2008, TOCL.

[47]  Frank Pfenning,et al.  Computation and Deduction , 2020 .

[48]  Dale Miller,et al.  A Lightweight Formalization of the Metatheory of Bisimulation-Up-To , 2015, CPP.

[49]  David Baelde,et al.  Least and Greatest Fixed Points in Linear Logic , 2007, TOCL.

[50]  Brigitte Pientka,et al.  Mechanizing proofs with logical relations - Kripke-style , 2018, Math. Struct. Comput. Sci..

[51]  Carolyn L. Talcott,et al.  1 Equivalence in Functional Languages with E ectsIan , 2007 .

[52]  Catuscia Palamidessi,et al.  Encoding Transition Systems in Sequent Calculus , 2003, Linear Logic Tokyo Meeting.

[53]  Brigitte Pientka Termination and Reduction Checking for Higher-Order Logic Programs , 2001, IJCAR.

[54]  Alwen Tiu,et al.  Programming in Higher-Order Logic , 2009 .

[55]  Gopalan Nadathur,et al.  Abella: A System for Reasoning about Relational Specifications , 2014, J. Formaliz. Reason..

[56]  Brigitte Pientka,et al.  First-class substitutions in contextual type theory , 2013, LFMTP '13.

[57]  Andrew Pitts,et al.  Advanced Topics in Bisimulation and Coinduction: Howe's method for higher-order languages , 2011 .

[58]  Robin Milner,et al.  Fully Abstract Models of Typed lambda-Calculi , 1977, Theor. Comput. Sci..

[59]  Alberto Momigliano,et al.  Cut elimination for a logic with induction and co-induction , 2012, J. Appl. Log..

[60]  Brigitte Pientka,et al.  Well-founded recursion with copatterns and sized types , 2016, Journal of Functional Programming.

[61]  Karl Crary,et al.  Syntactic Logical Relations for Polymorphic and Recursive Types , 2007, Computation, Meaning, and Logic.

[62]  Furio Honsell,et al.  A framework for defining logics , 1993, JACM.

[63]  Douglas J. Howe Proving Congruence of Bisimulation in Functional Programming Languages , 1996, Inf. Comput..

[64]  Brigitte Pientka,et al.  A Case Study on Logical Relations using Contextual Types , 2015, LFMTP.

[65]  Roy L. Crole,et al.  Mechanized Operational Semantics via (Co)Induction , 1999, TPHOLs.

[66]  Brigitte Pientka,et al.  A Unified Approach to Termination and Productivity , 2013 .

[67]  Amal Ahmed,et al.  Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types , 2006, ESOP.

[68]  Karl Crary,et al.  Towards a mechanized metatheory of standard ML , 2007, POPL '07.