Hostname: page-component-586b7cd67f-t7fkt Total loading time: 0 Render date: 2024-11-22T13:02:37.292Z Has data issue: false hasContentIssue false

Formal polytypic programs and proofs

Published online by Cambridge University Press:  23 September 2010

WENDY VERBRUGGEN
Affiliation:
School of Computer Science and Statistics Trinity College Dublin, College Green, Ireland (e-mail: wendyverbruggen@gmail.com, Edsko.de.Vries@scss.tcd.ie, Arthur.Hughes@scss.tcd.ie)
EDSKO DE VRIES
Affiliation:
School of Computer Science and Statistics Trinity College Dublin, College Green, Ireland (e-mail: wendyverbruggen@gmail.com, Edsko.de.Vries@scss.tcd.ie, Arthur.Hughes@scss.tcd.ie)
ARTHUR HUGHES
Affiliation:
School of Computer Science and Statistics Trinity College Dublin, College Green, Ireland (e-mail: wendyverbruggen@gmail.com, Edsko.de.Vries@scss.tcd.ie, Arthur.Hughes@scss.tcd.ie)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

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.

Type
Articles
Copyright
Copyright © Cambridge University Press 2010

References

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.CrossRefGoogle Scholar
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.Google Scholar
Abel, A. (2009) Type-based termination of generic programs, Sci. Comput. Program., 74 (8): 550567. Special Issue on Mathematics of Program Construction (MPC'06).CrossRefGoogle Scholar
Alimarine, A. (2005) Generic Functional Programming: Conceptual Design, Implementation and Applications. PhD thesis, Radboud Universiteit Nijmegen, The Netherlands.Google Scholar
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.Google Scholar
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.Google Scholar
Backhouse, R. & Hoogendijk, P. (2003) Generic properties of datatypes. In Generic Programming: Advanced Lectures. Lecture Notes in Computer Science, vol. 2793. Springer, pp. 97132.CrossRefGoogle Scholar
Benke, M., Dybjer, P. & Jansson, P. (2003) Universes for generic programs and proofs in dependent type theory, Nord. J. Comput., 10 (4): 265289.Google Scholar
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.CrossRefGoogle Scholar
Bertot, Y. & Castéran, P. (2004) Coq'Art: Interactive Theorem Proving and Program Development. Springer.CrossRefGoogle Scholar
Bertot, Y. & Komendantskaya, E. (2008) Inductive and coinductive components of corecursive functions in Coq, Electron. Notes Theor. Comput. Sci., 203 (5): 2547.Google Scholar
de Bruijn, N. G. (1972) A lambda calculus notation with nameless dummies, Indagationes Math., 34: 381392.Google Scholar
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.Google Scholar
Coq Development Team. (2008b) Coq reference manual (version 8.2) [online]. Accessed September 12, 2010. Available at: http://www.lix.polytechnique.fr/coq/refman/.Google Scholar
Gibbons, J. (2006) Datatype-generic programming. In School on Datatype-Generic Programming. Lecture Notes in Computer Science, vol. 4719. Springer, pp. 171.Google Scholar
Harper, R. & Pollack, R. (1991) Type checking with universes, Theor. Comput. Sci., 89: 107136.Google Scholar
Hinze, R. (2000) Generic Programs and Proofs. Germany: Habilitationsschrift, Universität Bonn.Google Scholar
Hinze, R. (2006) Generics for the masses, J. Funct. Program., 16: 451482.CrossRefGoogle Scholar
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.Google Scholar
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.Google Scholar
Hinze, R. & Löh, A. (2009) Generic programming in 3D, Sci. Comput. Program., 74: 590628.Google Scholar
Hinze, R. & PeytonJones, S. Jones, S. (2001) Derivable type classes, Electron. Notes Theor. Comput. Sci., 41 (1): 227236.CrossRefGoogle Scholar
Hoogendijk, P. & de Moor, O. (2000) Container types categorically, J. Funct. Program., 10 (2): 191225.CrossRefGoogle Scholar
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.CrossRefGoogle Scholar
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.CrossRefGoogle Scholar
Jay, C. B. (1995) A semantics for shape In Selected Papers of ESOP'94, the 5th European Symposium on Programming. Elsevier, pp. 251283.Google Scholar
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.CrossRefGoogle Scholar
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.Google Scholar
Löh, A. (2004) Exploring Generic Haskell. PhD thesis, Instituut voor Programmatuurkunde en Algoritmiek, Utrecht, The Netherlands.Google Scholar
McBride, C. (1999) Dependently Typed Functional Programs and Their Proofs. PhD thesis, University of Edinburgh.Google Scholar
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.CrossRefGoogle Scholar
Morris, P. & Altenkirch, T. (2009) Indexed containers. In LICS'09: 24th IEEE Symposium in Logic in Computer Science. Los Angeles, CA, USA.Google Scholar
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.CrossRefGoogle Scholar
Morris, P., Altenkirch, T. & Ghani, N. (January 2007) Constructing strictly positive families. In CATS'07: The Australian Theory Symposium. Ballarat, Australia.Google Scholar
Morris, P., Altenkirch, T. & Ghani, N. (2009) A universe of strictly positive families, Int. J. Found. Comput. Sci., 20 (1): 83107.CrossRefGoogle Scholar
Norell, U. (2002) Functional Generic Programming and Type Theory. MPhil thesis, Computing Science, Chalmers University of Technology.Google Scholar
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.Google Scholar
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.Google Scholar
Plotkin, G. (1975) Call-by-name, call-by-value and the λ-calculus, Theor. Comput. Sci., 1: 125159.CrossRefGoogle Scholar
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.Google Scholar
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.CrossRefGoogle Scholar
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.CrossRefGoogle Scholar
Sheard, T. (2007) Generic programming in Ωmega. In Spring School on Datatype-Generic Programming. Lecture Notes in Computer Science, vol. 4719. Springer, pp. 258284.CrossRefGoogle Scholar
Sørensen, M. H. & Urzyczyn, P. (2006) Lectures on the Curry-Howard Isomorphism. Elsevier.Google Scholar
Verbruggen, W. (2009) Coq Sources [online]. Accessed November 23, 2010. Available at: http://www.wendyverbruggen.net/publications.Google Scholar
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.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.