Formal polytypic programs and proofs

The aim of our work is to be able to do fully formal, machine verified proofs over Generic Haskell-style polytypic programs. In order to achieve this goal, we embed polytypic programming in the proof assistant Coq and provide an infrastructure for polytypic proofs. Polytypic functions are reified within Coq as a datatype and can then be specialized by applying a dependently typed term specialization function. Polytypic functions are thus first class citizens and can be passed as arguments or returned as results. Likewise, we reify polytypic proofs as a datatype, and provide a lemma that a polytypic proof can be specialized to any datatype in the universe. The correspondence between polytypic functions and their polytypic proofs is very clear: programmers need to give proofs for, and only for, the same cases that they need to give instances for when they define the polytypic function itself. Finally, we discuss how we can write (co)recursive functions and do (co)recursive proofs in a similar way that recursion is handled in Generic Haskell.

[1]  Thorsten Altenkirch,et al.  Generic Programming within Dependently Typed Programming , 2002, Generic Programming.

[2]  Stefano Berardi,et al.  Selected papers from the International Workshop on Types for Proofs and Programs , 1995 .

[3]  Ralf Hinze,et al.  Generic Programs and Proofs , 2000 .

[4]  Johan Jeuring,et al.  PolyP—a polytypic programming language extension , 1997, POPL '97.

[5]  Ekaterina Komendantskaya,et al.  Inductive and Coinductive Components of Corecursive Functions in Coq , 2008, CMCS.

[6]  Peter Morris,et al.  Indexed Containers , 2009, 2009 24th Annual IEEE Symposium on Logic In Computer Science.

[7]  M. F.,et al.  Bibliography , 1985, Experimental Gerontology.

[8]  Jeremy Gibbons,et al.  Parametric datatype-genericity , 2009, WGP '09.

[9]  Ulf Norell Functional generic programming and type theory , 2002 .

[10]  Simon L. Peyton Jones,et al.  Simple unification-based type inference for GADTs , 2006, ICFP '06.

[11]  Ralf Lämmel,et al.  Typed Combinators for Generic Traversal , 2002, PADL.

[12]  Sjaak Smetsers,et al.  Optimizing Generic Functions , 2004, MPC.

[13]  Thierry Coquand,et al.  The Calculus of Constructions , 1988, Inf. Comput..

[14]  Simon L. Peyton Jones,et al.  Scrap your boilerplate with class: extensible generic functions , 2005, ICFP '05.

[15]  Simon L. Peyton Jones,et al.  Derivable Type Classes , 2001, Haskell.

[16]  Ralf Hinze,et al.  Comparing Approaches to Generic Programming in Haskell , 2006, SSDGP.

[17]  Peter Dybjer,et al.  Universes for Generic Programs and Proofs in Dependent Type Theory , 2003, Nord. J. Comput..

[18]  Simon L. Peyton Jones,et al.  Compiling Haskell by Program Transformation: A Report from the Trenches , 1996, ESOP.

[19]  Johan Jeuring,et al.  Proceedings of the IFIP TC2/WG2.1 Working Conference on Generic Programming , 2002 .

[20]  C. Barry Jay,et al.  A Semantics for Shape , 1995, Sci. Comput. Program..

[21]  Ralf Hinze Generics for the masses , 2006, J. Funct. Program..

[22]  Ralf Hinze Polytypic Values Possess Polykinded Types , 2000, MPC.

[23]  Roland Carl Backhouse,et al.  Generic Programming: An Introduction , 1998, Advanced Functional Programming.

[24]  Ralf Hinze,et al.  "Scrap Your Boilerplate" Revolutions , 2006, MPC.

[25]  A. R. Alim Improved Fusion for Optimizing Generics , 2005 .

[26]  Fermín Reig Generic proofs for combinator-based generic programs , 2004, Trends in Functional Programming.

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

[28]  Pierre Castéran,et al.  Interactive Theorem Proving and Program Development , 2004, Texts in Theoretical Computer Science An EATCS Series.

[29]  Marinus J. Plasmeijer,et al.  iTasks: executable specifications of interactive work flow systems for the web , 2007, ICFP '07.

[30]  Peter Morris,et al.  Constructing Strictly Positive Families , 2007, CATS.

[31]  Andres Löh,et al.  Exploring generic Haskell , 2004 .

[32]  Roland Carl Backhouse,et al.  Generic Programming: Advanced Lectures , 2003 .

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

[34]  Roland Carl Backhouse,et al.  Generic Properties of Datatypes , 2003, Generic Programming.

[35]  Marinus J. Plasmeijer,et al.  Theorem Proving for functional Programmers - Sparkle: A Functional Theorem Prover , 2001 .

[36]  Venanzio Capretta,et al.  General recursion via coinductive types , 2005, Log. Methods Comput. Sci..

[37]  Conor McBride,et al.  Dependently typed functional programs and their proofs , 2000 .

[38]  Ralf Hinze,et al.  Generic programming in 3D , 2009, Sci. Comput. Program..

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

[40]  Ralf Hinze,et al.  Type-indexed data types , 2004, Sci. Comput. Program..

[41]  Simon L. Peyton Jones,et al.  Complete and decidable type inference for GADTs , 2009, ICFP.

[42]  Ralf Hinze,et al.  Generic Haskell: Practice and Theory , 2003, Generic Programming.

[43]  Artem Alimarine,et al.  Generic functional programming conceptual design, implementation and applications , 2005 .

[44]  Simon L. Peyton Jones,et al.  Boxy types: inference for higher-rank types and impredicativity , 2006, ICFP '06.

[45]  Harald Ruess,et al.  Polytypic Proof Construction , 1999, TPHOLs.

[46]  Peter Morris,et al.  A Universe of Strictly Positive Families , 2009, Int. J. Found. Comput. Sci..

[47]  Gordon D. Plotkin,et al.  Call-by-Name, Call-by-Value and the lambda-Calculus , 1975, Theor. Comput. Sci..

[48]  Robert Harper,et al.  Type Checking with Universes , 1991, Theor. Comput. Sci..

[49]  Marino Miculan,et al.  A Unifying Approach to Recursive and Co-recursive Definitions , 2002, TYPES.

[50]  Ralf Hinze,et al.  Generic Programming, Now! , 2006, SSDGP.

[51]  Bruno C. d. S. Oliveira,et al.  Comparing libraries for generic programming in haskell , 2008, Haskell '08.

[52]  Edsko de Vries,et al.  Polytypic programming in COQ , 2008, WGP '08.

[53]  Peter Morris,et al.  Exploring the Regular Tree Types , 2004, TYPES.

[54]  Johan Jeuring,et al.  Generic programming with fixed points for mutually recursive datatypes , 2009, ICFP.

[55]  Antonius J. C. Hurkens A Simplification of Girard's Paradox , 1995, TLCA.

[56]  de Ng Dick Bruijn Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem , 1972 .

[57]  Simon L. Peyton Jones,et al.  Scrap Your Boilerplate , 2003, APLAS.

[58]  Tim Sheard,et al.  Generic Programming in Ωmega , 2006, SSDGP.

[59]  Paul F. Hoogendijk,et al.  Container types categorically , 2000, Journal of Functional Programming.

[60]  Lawrence C. Paulson,et al.  The foundation of a generic theorem prover , 1989, Journal of Automated Reasoning.

[61]  Thorsten Altenkirch,et al.  Foundations of Software Science and Computation Structures: 6th International Conference, FOSSACS 2003 Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2003 Warsaw, Poland, April 7–11, 2003 Proceedings , 2003, Lecture Notes in Computer Science.

[62]  Bruno C. d. S. Oliveira,et al.  "Scrap Your Boilerplate" Reloaded , 2006, FLOPS.

[63]  Yves Bertot,et al.  Filters on CoInductive Streams, an Application to Eratosthenes' Sieve , 2005, TLCA.

[64]  Conor McBride,et al.  Elimination with a Motive , 2000, TYPES.

[65]  Jeremy Gibbons Datatype-Generic Programming , 2006, SSDGP.

[66]  Ana Bove,et al.  General Recursion in Type Theory , 2002, TYPES.

[67]  Andreas Abel Type-based termination of generic programs , 2009, Sci. Comput. Program..

[68]  Marinus J. Plasmeijer,et al.  A Generic Programming Extension for Clean , 2001, IFL.

[69]  Peter Morris,et al.  Generic Programming with Dependent Types , 2006, SSDGP.

[70]  Edsko de Vries,et al.  Polytypic properties and proofs in Coq , 2009, WGP '09.

[71]  Andreas Abel,et al.  Type-based termination: a polymorphic lambda-calculus with sized higher-order types , 2006 .