Skip to main content Accessibility help
×
×
Home

Formal polytypic programs and proofs

  • WENDY VERBRUGGEN (a1), EDSKO DE VRIES (a1) and ARTHUR HUGHES (a1)
Abstract

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 they 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 to write (co)recursive functions and do (co)recursive proofs in a similar way that recursion is handled in Generic Haskell.

Copyright
References
Hide All
Abbott, M., Altenkirch, T. & Ghani, N. (2003) Categories of containers. In Proceedings of the 6th International Conference on Foundations of Software Science and Computation Structures, Warsaw, Poland. Lecture Notes in Computer Science, vol. 2620. Springer, pp. 2338.
Abel, A. (2006) Type-Based Termination: A Polymorphic Lambda-Calculus with Sized Higher-Order Types. PhD thesis, Fakültat für Mathematik, Informatik und Statistik der Ludwig-Maximilians-Universität München.
Abel, A. (2009) Type-based termination of generic programs, Sci. Comput. Program., 74 (8): 550567. Special Issue on Mathematics of Program Construction (MPC'06).
Alimarine, A. (2005) Generic Functional Programming: Conceptual Design, Implementation and Applications. PhD thesis, Radboud Universiteit Nijmegen, The Netherlands.
Altenkirch, T. & McBride, C. (2003) Generic programming within dependently typed programming. In Proceedings of the IFIP TC2/WG2.1 Working Conference on Generic Programming, Schloss Dagstuhl, July 2002. Kluwer, pp. 120.
Altenkirch, T., McBride, C. & McKinna, J. (April 2005). Why dependent types matter [online]. Accessed September 12, 2010. Available at: http://www.cs.nott.ac.uk/~txa/publ/ydtm.pdf.
Backhouse, R. & Hoogendijk, P. (2003) Generic properties of datatypes. In Generic Programming: Advanced Lectures. Lecture Notes in Computer Science, vol. 2793. Springer, pp. 97132.
Benke, M., Dybjer, P. & Jansson, P. (2003) Universes for generic programs and proofs in dependent type theory, Nord. J. Comput., 10 (4): 265289.
Bertot, Y. (2005) Filters on coinductive streams, an application to eratosthenes' sieve. In TLCA'05: Proceedings of the 7th International Conference on Typed Lambda Calculi and Applications. Lecture Notes in Computer Science, vol. 3461. Nara, Japan: Springer, pp. 102115.
Bertot, Y. & Castéran, P. (2004) Coq'Art: Interactive Theorem Proving and Program Development. Springer.
Bertot, Y. & Komendantskaya, E. (2008) Inductive and coinductive components of corecursive functions in Coq, Electron. Notes Theor. Comput. Sci., 203 (5): 2547.
de Bruijn, N. G. (1972) A lambda calculus notation with nameless dummies, Indagationes Math., 34: 381392.
Coq Development Team. (2008a) Coq frequently asked questions (v8.1) [online]. Accessed September 12, 2010. Available at: http://www.lix.polytechnique.fr/coq/node/16.
Coq Development Team. (2008b) Coq reference manual (version 8.2) [online]. Accessed September 12, 2010. Available at: http://www.lix.polytechnique.fr/coq/refman/.
Gibbons, J. (2006) Datatype-generic programming. In School on Datatype-Generic Programming. Lecture Notes in Computer Science, vol. 4719. Springer, pp. 171.
Harper, R. & Pollack, R. (1991) Type checking with universes, Theor. Comput. Sci., 89: 107136.
Hinze, R. (2000) Generic Programs and Proofs. Germany: Habilitationsschrift, Universität Bonn.
Hinze, R. (2006) Generics for the masses, J. Funct. Program., 16: 451482.
Hinze, R., Jeuring, J. & Löh, A. (2006) Comparing approaches to generic programming in Haskell. In School on Datatype-Generic Programming. Lecture Notes in Computer Science, vol. 4719. Springer, pp. 72149.
Hinze, R. & Löh, A. (2006) Generic programming, now! In School on Datatype-Generic Programming. Lecture Notes in Computer Science, vol. 4719. Springer, pp. 150208.
Hinze, R. & Löh, A. (2009) Generic programming in 3D, Sci. Comput. Program., 74: 590628.
Hinze, R. & PeytonJones, S. Jones, S. (2001) Derivable type classes, Electron. Notes Theor. Comput. Sci., 41 (1): 227236.
Hoogendijk, P. & de Moor, O. (2000) Container types categorically, J. Funct. Program., 10 (2): 191225.
Hurkens, A. J. C. (1995) A simplification of Girard's paradox. In TLCA'95: Proceedings of the Second International Conference on Typed Lambda Calculi and Applications, Edinburgh, UK. Springer, pp. 266278.
Jansson, P. & Jeuring, J. (1997) PolyP – A polytypic programming language extension. In Popl'97: Conference Record 24th ACM SIGPLAN–SIGACT Symposium on Principles of Programming Languages Paris, France. ACM, pp. 470482.
Jay, C. B. (1995) A semantics for shape In Selected Papers of ESOP'94, the 5th European Symposium on Programming. Elsevier, pp. 251283.
Lämmel, R. & Peyton Jones, S. (2003) Scrap your boilerplate: A practical design pattern for generic programming. In TLDI'03: ACM SIGPLAN International Workshop on Types in Language Design and Implementation, New Orleans, Louisiana, USA, vol. 38. ACM, pp. 2637.
Lämmel, R. & Visser, J. (2002) Typed combinators for generic traversal. In PADL'02: Proceedings of the 4th International Symposium on Practical Aspects of Declarative Languages, Portland, OR, USA. Lecture Notes in Computer Science, vol. 2257. Springer, pp. 137154.
Löh, A. (2004) Exploring Generic Haskell. PhD thesis, Instituut voor Programmatuurkunde en Algoritmiek, Utrecht, The Netherlands.
McBride, C. (1999) Dependently Typed Functional Programs and Their Proofs. PhD thesis, University of Edinburgh.
McBride, C. (2002) Elimination with a motive. In TYPES'00: Selected Papers from the International Workshop on Types for Proofs and Programs, Durham, UK. Springer, pp. 197216.
Morris, P. & Altenkirch, T. (2009) Indexed containers. In LICS'09: 24th IEEE Symposium in Logic in Computer Science. Los Angeles, CA, USA.
Morris, P., Altenkirch, T. & McBride, C. (2006) Exploring the regular tree types. In TYPES'04: Types for Proofs and Programs, France. Lecture Notes in Computer Science, vol. 3839. Springer, pp. 252267.
Morris, P., Altenkirch, T. & Ghani, N. (January 2007) Constructing strictly positive families. In CATS'07: The Australian Theory Symposium. Ballarat, Australia.
Morris, P., Altenkirch, T. & Ghani, N. (2009) A universe of strictly positive families, Int. J. Found. Comput. Sci., 20 (1): 83107.
Norell, U. (2002) Functional Generic Programming and Type Theory. MPhil thesis, Computing Science, Chalmers University of Technology.
PeytonJones, S. Jones, S. (1996) Compiling Haskell by program transformation: A report from the trenches. In ESOP'96: Proceedings of the European Symposium on Programming, Linköping, Sweden. Lecture Notes in Computer Science, vol. 1058. Springer, pp. 1844.
Pfeifer, H. & Rueß, H. (1999) Polytypic proof construction. In TPHOLs'99: Proceedings of the 12th International Conference on Theorem Proving in Higher-Order Logics, Nice, France. Springer, pp. 5572.
Plotkin, G. (1975) Call-by-name, call-by-value and the λ-calculus, Theor. Comput. Sci., 1: 125159.
Rodriguez, A., Holdermans, S., Löh, A. & Jeuring, J. (2009) Generic programming with fixed points for mutually recursive datatypes. In ICFP'09: Proceeding of the 14th ACM SIGPLAN International Conference on Functional Programming, Edinburgh, UK. ACM, pp. 233244.
Rodriguez, A., Jeuring, J., Jansson, P., Gerdes, A., Kiselyov, O. & , d. S.Oliveira, B. C. (2008) Comparing libraries for generic programming in Haskell. In Haskell'08: Proceedings of the First ACM SIGPLAN Symposium on Haskell, Victoria, British Columbia, Canada. ACM, pp. 111122.
Schrijvers, T., PeytonJones, S. Jones, S., Sulzmann, M. & Vytiniotis, D. (2009) Complete and decidable type inference for GADTs. In ICFP '09: Proceedings of the 14th ACM SIGPLAN International Conference on Functional Programming, Edinburgh, UK. ACM, pp. 341352.
Sheard, T. (2007) Generic programming in Ωmega. In Spring School on Datatype-Generic Programming. Lecture Notes in Computer Science, vol. 4719. Springer, pp. 258284.
Sørensen, M. H. & Urzyczyn, P. (2006) Lectures on the Curry-Howard Isomorphism. Elsevier.
Verbruggen, W. (2009) Coq Sources [online]. Accessed November 23, 2010. Available at: http://www.wendyverbruggen.net/publications.
Vytiniotis, D., Weirich, S. & PeytonJones, S. Jones, S. (2006) Boxy types: Inference for higher-rank types and impredicativity. In ICFP'06: Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, Portland, Oregon. ACM, pp. 251262.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

Formal polytypic programs and proofs

  • WENDY VERBRUGGEN (a1), EDSKO DE VRIES (a1) and ARTHUR HUGHES (a1)
Submit a response

Discussions

No Discussions have been published for this article.

×

Reply to: Submit a response


Your details


Conflicting interests

Do you have any conflicting interests? *