Abstract
Instances of a polytypic or generic program for a concrete recursive type often exhibit a recursion scheme that is derived from the recursion scheme of the instantiation type. In practice, the programs obtained from a generic program are usually terminating, but the proof of termination cannot be carried out with traditional methods as term orderings alone, since termination often crucially relies on the program type. This problem is tackled by an adaption of type-based termination to generic programming, and a framework for sized polytypic programming is described.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Abel, A.: Termination and guardedness checking with continuous types. In: Hofmann, M.O. (ed.) TLCA 2003. LNCS, vol. 2701, pp. 1–15. Springer, Heidelberg (2003)
Abel, A.: Termination checking with types. Theor. Inform. and Appl. 38, 277–319 (2004)
Abel, A.: A Polymorphic Lambda-Calculus with Sized Higher-Order Types. PhD thesis, Ludwig-Maximilians-Universität München (2006), Draft available at: http://www.tcs.ifi.lmu.de/~abel/diss.pdf
Abel, A., Matthes, R., Uustalu, T.: Iteration schemes for higher-order and nested datatypes. Theor. Comput. Sci. 333, 3–66 (2005)
Altenkirch, T., McBride, C.: Generic programming within dependently typed programming. In: Gibbons, J., Jeuring, J. (eds.) Proc. of IFIP TC2/WG2.1 Working Conf. on Generic Programming, WCGP 2002. IFIP Conf. Proceedings, vol. 243, pp. 1–20. Kluwer, Dordrecht (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: Swierstra, S.D., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)
Barthe, G., Frade, M.J., Giménez, E., Pinto, L., Uustalu, T.: Type-based termination of recursive definitions. Math. Struct. in Comput. Sci. 14, 1–45 (2004)
Barthe, G., Grégoire, B., Pastawski, F.: Practical inference for type-based termination in a polymorphic setting. In: Urzyczyn, P. (ed.) TLCA 2005. LNCS, vol. 3461, pp. 71–85. Springer, Heidelberg (2005)
Benke, M., Dybjer, P., Jansson, P.: Universes for generic programs and proofs in dependent type theory. Nord. J. of Comput. 10, 265–289 (2003)
Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)
Bird, R., Paterson, R.: Generalised folds for nested datatypes. Formal Asp. Comput. 11, 200–222 (1999)
Bird, R.S., Paterson, R.: De Bruijn notation as a nested datatype. J. Funct. Program. 9, 77–91 (1999)
Blanqui, F.: A type-based termination criterion for dependently-typed higher-order rewrite systems. In: van Oostrom, V. (ed.) RTA 2004. LNCS, vol. 3091, pp. 24–39. Springer, Heidelberg (2004)
Blanqui, F.: Decidability of Type-Checking in the Calculus of Algebraic Constructions with Size Annotations. In: Ong, L. (ed.) CSL 2005. LNCS, vol. 3634, pp. 135–150. Springer, Heidelberg (2005)
Crary, K., Weirich, S.: Flexible type analysis. In: Proc.of 4th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 1999, pp. 233–248. ACM Press, New York (1999)
Crary, K., Weirich, S., Morrisett, J.G.: Intensional polymorphism in type-erasure semantics. In: Proc. of 3rd ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 1998, pp. 301–312. ACM Press, New York (1998)
Frade, M.J.: Type-Based Termination of Recursive Definitions and Constructor Subtyping in Typed Lambda Calculi. PhD thesis, Dep. de Informática, Universidade do Minho (2003)
Giesl, J., Thiemann, R., Schneider-Kamp, P., Falke, S.: Automated termination proofs with AProVE. In: van Oostrom, V. (ed.) RTA 2004. LNCS, vol. 3091, pp. 210–220. Springer, Heidelberg (2004)
Giménez, E.: Structural recursive definitions in type theory. In: Larsen, K.G., Skyum, S., Winskel, G. (eds.) ICALP 1998. LNCS, vol. 1443, pp. 397–408. Springer, Heidelberg (1998)
Harper, R., Morrisett, J.G.: Compiling polymorphism using intensional type analysis. In: Conf. Record of 22nd ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 1995, pp. 130–141. ACM Press, New York (1995)
Hinze, R.: Numerical representations as higher-order nested datatypes. Technical Report IAI-TR-98-12, Institut für Informatik III, Universität Bonn (1998)
Hinze, R.: Polytypic programming with ease (extended abstract). In: Middeldorp, A. (ed.) FLOPS 1999. LNCS, vol. 1722, pp. 21–36. Springer, Heidelberg (1999)
Hinze, R.: Generalizing generalized tries. J. of Funct. Program. 10, 327–351 (2000)
Hinze, R.: A new approach to generic functional programming. In: Proc. of 27th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 2000, pp. 119–132. ACM Press, New York (2000)
Hinze, R.: Manufacturing datatypes. J. of Funct. Program. 11, 493–524 (2001)
Hinze, R.: Polytypic values possess polykinded types. Sci. of Comput. Program. 43, 129–159 (2002)
Hinze, R., Jeuring, J.: Generic haskell: Applications. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 57–96. Springer, Heidelberg (2003)
Hinze, R., Jeuring, J.: Generic haskell: Practice and theory. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 1–56. Springer, Heidelberg (2003)
Hinze, R., Jeuring, J., Löh, A.: Type-indexed data types. Sci. of Comput. Program. 51, 117–151 (2004)
Hughes, J., Pareto, L., Sabry, A.: Proving the correctness of reactive systems using sized types. In: Conf. Record of 23rd ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 1996, pp. 410–423. ACM Press, New York (1996)
INRIA: The Coq Proof Assistant Reference Manual, version 8.0 edition (2004), http://coq.inria.fr/doc/main.html
Jansson, P.: Functional Polytypic Programming. PhD thesis, Dept. of Computing Science, Chalmers University of Technology (2000)
Jansson, P., Jeuring, J.: PolyP—a polytypic programming extension. In: Conf. Record of 24th ACM SIGPLAN-SIGACT Symp. on Principles of Programming Languages, POPL 1997, pp. 470–482. ACM Press, New York (1997)
Jansson, P., Jeuring, J.: Polytypic data conversion programs. Sci. of Comput. Program. 43, 35–75 (2002)
Martin, C., Gibbons, J., Bayley, I.: Disciplined, efficient, generalised folds for nested datatypes. Formal Asp. of Comput. 16, 19–35 (2004)
Mendler, N.P.: Recursive types and type constraints in second-order lambda calculus. In: Proc. of 2nd Ann. IEEE Symp. on Logic in Computer Science, LICS 1987, pp. 30–36. IEEE Computer Soc. Press, Los Alamitos (1987)
Norell, U.: Functional Generic Programming and Type Theory. Master’s thesis, Computing Science, Chalmers University of Technology (2002), Available from: http://www.cs.chalmers.se/~ulfn
Norell, U., Jansson, P.: Polytypic programming in Haskell. In: Trinder, P., Michaelson, G.J., Peña, R. (eds.) IFL 2003. LNCS, vol. 3145, pp. 168–184. Springer, Heidelberg (2004)
Norell, U., Jansson, P.: Prototyping generic programming in template haskell. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 314–333. Springer, Heidelberg (2004)
Okasaki, C.: Purely Functional Data Structures. Ph.D. thesis, Carnegie Mellon University (1996)
Okasaki, C.: From fast exponentiation to square matrices: An adventure in types. In: Proc. of 4th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 1999, pp. 28–35. ACM Press, New York (1999)
Okasaki, C.: Red-black trees in a functional setting. J. of Funct. Program. 9, 471–477 (1999)
Pareto, L.: Types for Crash Prevention. PhD thesis, Dept. of Computing Science, Chalmers University of Technology (2000)
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)
Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)
Saha, B., Trifonov, V., Shao, Z.: Intensional analysis of quantified types. ACM Trans. on Program. Lang. and Syst. 25, 159–209 (2003)
Sereni, D., Jones, N.D.: Termination analysis of higher-order functional programs. In: Yi, K. (ed.) APLAS 2005. LNCS, vol. 3780, pp. 281–297. Springer, Heidelberg (2005)
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
Abel, A. (2006). Towards Generic Programming with Sized Types. In: Uustalu, T. (eds) Mathematics of Program Construction. MPC 2006. Lecture Notes in Computer Science, vol 4014. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11783596_4
Download citation
DOI: https://doi.org/10.1007/11783596_4
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-35631-8
Online ISBN: 978-3-540-35632-5
eBook Packages: Computer ScienceComputer Science (R0)