Abstract
In this paper we use the Epigram language to define the universe of regular tree types—closed under empty, unit, sum, product and least fixpoint. We then present a generic decision procedure for Epigram’s in-built equality at each type, taking a complementary approach to that of Benke, Dybjer and Jansson [7]. We also give a generic definition of map, taking our inspiration from Jansson and Jeuring [21]. Finally, we equip the regular universe with the partial derivative which can be interpreted functionally as Huet’s notion of ‘zipper’, as suggested by McBride in [27] and implemented (without the fixpoint case) in Generic Haskell by Hinze, Jeuring and Löh [18]. We aim to show through these examples that generic programming can be ordinary programming in a dependently typed language.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Abbott, M.: Categories of Containers. PhD thesis, University of Leicester (2003)
Abbott, M., Altenkirch, T., Ghani, N.: Categories of containers. In: Proceedings of Foundations of Software Science and Computation Structures (2003)
Abbott, M., Altenkirch, T., Ghani, N., McBride, C.: \(\partial\) for data: derivatives of data structures. Fundamenta Informaticae 65(1,2), 1–128 (2005)
Altenkirch, T., McBride, C.: Generic programming within dependently typed programming. In: Generic Programming, Proceedings of the IFIP TC2 Working Conference on Generic Programming, Schloss Dagstuhl, July 2002 (2003)
Altenkirch, T., Reus, B.: Monadic presentations of lambda-terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 453–468. Springer, Heidelberg (1999)
Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic Programming—An Introduction. In: Doaitse Sweierstra, S., Henriques, P.R., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)
Benke, M., Dybjer, P., Jansson, P.: Universes for generic programs and proofs in dependent type theory. Nordic Journal of Computing 10, 265–269 (2003)
Brady, E.: Practical Implementation of a Dependently Typed Functional Programming Language. PhD thesis, University of Durham (2005)
Brady, E., McBride, C., McKinna, J.: Inductive families need not store their indices. In: Berardi, S., Coppo, M., Damiani, F. (eds.) TYPES 2003. LNCS, vol. 3085, pp. 115–129. Springer, Heidelberg (2004)
Clarke, D., Hinze, R., Jeuring, J., Löh, A., de Wit, J.: The Generic Haskell user’s guide. Technical Report UU-CS-2001-26, Utrecht University (2001)
L’Équipe Coq. The Coq Proof Assistant Reference Manual (2001), http://pauillac.inria.fr/coq/doc/main.html
Coquand, C., Coquand, T.: Structured Type Theory. In: Workshop on Logical Frameworks and Metalanguages (1999)
Coquand, T.: Pattern Matching with Dependent Types. In: Nordström, B., Petersson, K., Plotkin, G. (eds.) Electronic Proceedings of the Third Annual BRA Workshop on Logical Frameworks, Båstad, Sweden (1992)
de Bruijn, N.G.: Lambda Calculus notation with nameless dummies: a tool for automatic formula manipulation. Indagationes Mathematicæ 34, 381–392 (1972)
de Bruijn, N.G.: Telescopic Mappings in Typed Lambda-Calculus. Information and Computation 91, 189–204 (1991)
Dybjer, P.: Inductive Sets and Families in Martin-Löf’s Type Theory. In: Huet, G., Plotkin, G. (eds.) Logical Frameworks, CUP (1991)
Dybjer, P., Setzer, A.: Indexed induction-recursion. In: Kahle, R., Schroeder-Heister, P., Stärk, R.F. (eds.) PTCS 2001. LNCS, vol. 2183, pp. 93–113. Springer, Heidelberg (2001)
Hinze, R., Jeuring, J., Löh, A.: Type-indexed data types. Science of Computer Programmming 51, 117–151 (2004)
Hosoya, H., Vouillon, J., Pierce, B.C.: Regular Expression Types for XML. In: Proceedings of the International Conference on Functional Programming (2000)
Huet, G.: The Zipper. Journal of Functional Programming 7(5), 549–554 (1997)
Jansson, P., Jeuring, J.: PolyP—a polytypic programming language extension. In: Proceedings of POPL 1997, pp. 470–482. ACM, New York (1997)
Leibniz, G.: Nova methodus pro maximis et minimis, itemque tangentibus, qua nec irrationals quantitates moratur. Acta Eruditorum (1684)
Luo, Z.: Computation and Reasoning: A Type Theory for Computer Science. Oxford University Press, Oxford (1994)
Luo, Z., Pollack, R.: LEGO Proof Development System: User’s Manual. Technical Report ECS-LFCS-92-211, Laboratory for Foundations of Computer Science, University of Edinburgh (1992)
Magnusson, L., Nordström, B.: The ALF proof editor and its proof engine. In: Barendregt, H., Nipkow, T. (eds.) TYPES 1993. LNCS, vol. 806. Springer, Heidelberg (1994)
Martin-Löf, P.: Intuitionistic Type Theory. Bibliopolis, Napoli (1984)
McBride, C.: The Derivative of a Regular Type is its Type of One-Hole Contexts (2001), Available at: http://www.dur.ac.uk/c.t.mcbride/diff.ps
McBride, C.: Elimination with a Motive. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) TYPES 2000. LNCS, vol. 2277, p. 197. Springer, Heidelberg (2002)
McBride, C.: Epigram: Practical programming with dependent types. In: Vene, V., Uustalu, T. (eds.) AFP 2004. LNCS, vol. 3622, pp. 130–170. Springer, Heidelberg (2005)
McBride, C., McKinna, J.: The view from the left. Journal of Functional Programming 14(1) (2004)
McBride, F.: Computer Aided Manipulation of Symbols. PhD thesis, Queen’s University of Belfast (1970)
Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML, revised edition. MIT Press, Cambridge (1997)
Pfeifer, H., Rueß, H.: Polytypic Proof Construction. In: Bertot, Y., Dowek, G., Hirschowitz, A., Paulin, C., Théry, L. (eds.) TPHOLs 1999. LNCS, vol. 1690, pp. 55–72. Springer, Heidelberg (1999)
Nordström, B., Petersson, K., Smith, J.: Programming in Martin-Löf’s type theory: an introduction. Oxford University Press, Oxford (1990)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Morris, P., Altenkirch, T., McBride, C. (2006). Exploring the Regular Tree Types. In: Filliâtre, JC., Paulin-Mohring, C., Werner, B. (eds) Types for Proofs and Programs. TYPES 2004. Lecture Notes in Computer Science, vol 3839. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11617990_16
Download citation
DOI: https://doi.org/10.1007/11617990_16
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-31428-8
Online ISBN: 978-3-540-31429-5
eBook Packages: Computer ScienceComputer Science (R0)