Chasing Bottoms: A Case Study in Program Verification in the Presence of Partial and Infinite Values

This work is a case study in program verification: We have written a simple parser and a corresponding pretty-printer in a non-strict functional programming language with lifted pairs and functions (Haskell). A natural aim is to prove that the programs are, in some sense, each others' inverses. The presence of partial and infinite values in the domains makes this exercise interesting, and having lifted types adds an extra spice to the task. We have tackled the problem in different ways, and this is a report on the merits of those approaches. More specifically, we first describe a method for testing properties of programs in the presence of partial and infinite values. By testing before proving we avoid wasting time trying to prove statements that are not valid. Then we prove that the programs we have written are in fact (more or less) inverses using first fixpoint induction and then the approximation lemma.

[1]  Lars Hallnäs An Intensional Characterization of the Largest Bisimulation , 1987, Theor. Comput. Sci..

[2]  John C. Reynolds,et al.  Types, Abstraction and Parametric Polymorphism , 1983, IFIP Congress.

[3]  Graham Hutton,et al.  Proof Methods for Corecursive Programs , 2005, Fundam. Informaticae.

[4]  David A. Schmidt,et al.  Denotationaisemantics: a methodology for language development , 1986 .

[5]  Maarten M. Fokkinga,et al.  Program Calculation Properties of Continuous Algebras , 1991 .

[6]  Peter Dybjer,et al.  Program Verification in a Logical Theory of Constructions , 1985, FPCA.

[7]  Peter Aczel,et al.  The Strength of Martin-Löf's Intuitionistic Type Theory with One Universe , 1984 .

[8]  Dana S. Scott,et al.  Data Types as Lattices , 1976, SIAM J. Comput..

[9]  Thorsten Altenkirch,et al.  Containers: Constructing strictly positive types , 2005, Theor. Comput. Sci..

[10]  David Sands,et al.  Total correctness by local improvement in the transformation of functional programs , 1996, TOPL.

[11]  Alberto Pardo,et al.  Monadic Corecursion - Definition, Fusion Laws, and Applications , 1998, CMCS.

[12]  William L. Harrison,et al.  Fine Control of Demand in Haskell , 2002, MPC.

[13]  Johan Jeuring Algorithms for Theorems , 1990, Programming Concepts and Methods.

[14]  Richard S. Bird,et al.  Algebra of programming , 1997, Prentice Hall International series in computer science.

[15]  Patricia Johann,et al.  Free theorems in the presence of seq , 2004, POPL.

[16]  Michael Beeson,et al.  Recursive models for constructive set theories , 1982, Ann. Math. Log..

[17]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[18]  William L. Harrison,et al.  Under Consideration for Publication in J. Functional Programming the Logic of Demand in Haskell , 2022 .

[19]  John C. Reynolds,et al.  Polymorphism is not Set-Theoretic , 1984, Semantics of Data Types.

[20]  Simon L. Peyton Jones,et al.  Scrap your boilerplate: a practical design pattern for generic programming , 2003, TLDI '03.

[21]  Manuel M. T. Chakravarty,et al.  The haskell 98 foreign function interface 1 , 2003 .

[22]  Jeremy Gibbons,et al.  Deriving Tidy Drawings of Trees , 1996, J. Funct. Program..

[23]  John Hughes,et al.  Why Functional Programming Matters , 1989, Comput. J..

[24]  Johan Jeuring,et al.  Polytypic data conversion programs , 2002, Sci. Comput. Program..

[25]  Maarten M. Fokkinga,et al.  Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire , 1991, FPCA.

[26]  Peter D. Mosses,et al.  Denotational semantics , 1995, LICS 1995.

[27]  Lambert Meertens,et al.  Algorithmics : towards programming as a mathematical activity , 1986 .

[28]  Richard S. Bird,et al.  An introduction to the theory of lists , 1987 .

[29]  Jan M. Smith,et al.  An interpretation of Martin-Löf's type theory in a type-free theory of propositions , 1984, Journal of Symbolic Logic.

[30]  Peter Dybjer,et al.  Representing Inductively Defined Sets by Wellorderings in Martin-Löf's Type Theory , 1997, Theor. Comput. Sci..

[31]  Philip Wadler,et al.  Theorems for free! , 1989, FPCA.

[32]  H. Friedman Equality between functionals , 1975 .

[33]  G. Malcolm,et al.  Data Structures and Program Transformation , 1990, Sci. Comput. Program..

[34]  Karl-Filip Faxén,et al.  A static semantics for Haskell , 2002, Journal of Functional Programming.

[35]  Koen Claessen,et al.  QuickCheck: a lightweight tool for random testing of Haskell programs , 2000, ICFP.

[36]  Graham Hutton,et al.  The generic approximation lemma , 2001, Inf. Process. Lett..