Skip to main content

Towards Generic Programming with Sized Types

  • Conference paper
Book cover Mathematics of Program Construction (MPC 2006)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4014))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Chapter  Google Scholar 

  2. Abel, A.: Termination checking with types. Theor. Inform. and Appl. 38, 277–319 (2004)

    Article  MATH  MathSciNet  Google Scholar 

  3. 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

  4. Abel, A., Matthes, R., Uustalu, T.: Iteration schemes for higher-order and nested datatypes. Theor. Comput. Sci. 333, 3–66 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  5. 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)

    Google Scholar 

  6. 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)

    Chapter  Google Scholar 

  7. 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)

    Chapter  Google Scholar 

  8. 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)

    Article  Google Scholar 

  9. 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)

    Chapter  Google Scholar 

  10. Benke, M., Dybjer, P., Jansson, P.: Universes for generic programs and proofs in dependent type theory. Nord. J. of Comput. 10, 265–289 (2003)

    MATH  MathSciNet  Google Scholar 

  11. Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)

    Chapter  Google Scholar 

  12. Bird, R., Paterson, R.: Generalised folds for nested datatypes. Formal Asp. Comput. 11, 200–222 (1999)

    Article  MATH  Google Scholar 

  13. Bird, R.S., Paterson, R.: De Bruijn notation as a nested datatype. J. Funct. Program. 9, 77–91 (1999)

    Article  MATH  MathSciNet  Google Scholar 

  14. 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)

    Chapter  Google Scholar 

  15. 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)

    Chapter  Google Scholar 

  16. 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)

    Chapter  Google Scholar 

  17. 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)

    Chapter  Google Scholar 

  18. 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)

    Google Scholar 

  19. 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)

    Chapter  Google Scholar 

  20. 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)

    Chapter  Google Scholar 

  21. 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)

    Chapter  Google Scholar 

  22. Hinze, R.: Numerical representations as higher-order nested datatypes. Technical Report IAI-TR-98-12, Institut für Informatik III, Universität Bonn (1998)

    Google Scholar 

  23. Hinze, R.: Polytypic programming with ease (extended abstract). In: Middeldorp, A. (ed.) FLOPS 1999. LNCS, vol. 1722, pp. 21–36. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  24. Hinze, R.: Generalizing generalized tries. J. of Funct. Program. 10, 327–351 (2000)

    Article  MATH  MathSciNet  Google Scholar 

  25. 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)

    Chapter  Google Scholar 

  26. Hinze, R.: Manufacturing datatypes. J. of Funct. Program. 11, 493–524 (2001)

    MATH  MathSciNet  Google Scholar 

  27. Hinze, R.: Polytypic values possess polykinded types. Sci. of Comput. Program. 43, 129–159 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  28. Hinze, R., Jeuring, J.: Generic haskell: Applications. In: Backhouse, R., Gibbons, J. (eds.) Generic Programming. LNCS, vol. 2793, pp. 57–96. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  29. 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)

    Chapter  Google Scholar 

  30. Hinze, R., Jeuring, J., Löh, A.: Type-indexed data types. Sci. of Comput. Program. 51, 117–151 (2004)

    Article  MATH  Google Scholar 

  31. 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)

    Chapter  Google Scholar 

  32. INRIA: The Coq Proof Assistant Reference Manual, version 8.0 edition (2004), http://coq.inria.fr/doc/main.html

  33. Jansson, P.: Functional Polytypic Programming. PhD thesis, Dept. of Computing Science, Chalmers University of Technology (2000)

    Google Scholar 

  34. 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)

    Chapter  Google Scholar 

  35. Jansson, P., Jeuring, J.: Polytypic data conversion programs. Sci. of Comput. Program. 43, 35–75 (2002)

    Article  MATH  MathSciNet  Google Scholar 

  36. Martin, C., Gibbons, J., Bayley, I.: Disciplined, efficient, generalised folds for nested datatypes. Formal Asp. of Comput. 16, 19–35 (2004)

    Article  MATH  Google Scholar 

  37. 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)

    Google Scholar 

  38. 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

  39. 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)

    Chapter  Google Scholar 

  40. 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)

    Chapter  Google Scholar 

  41. Okasaki, C.: Purely Functional Data Structures. Ph.D. thesis, Carnegie Mellon University (1996)

    Google Scholar 

  42. 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)

    Chapter  Google Scholar 

  43. Okasaki, C.: Red-black trees in a functional setting. J. of Funct. Program. 9, 471–477 (1999)

    Article  MATH  Google Scholar 

  44. Pareto, L.: Types for Crash Prevention. PhD thesis, Dept. of Computing Science, Chalmers University of Technology (2000)

    Google Scholar 

  45. 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)

    Chapter  Google Scholar 

  46. Pierce, B.C.: Types and Programming Languages. MIT Press, Cambridge (2002)

    Google Scholar 

  47. Saha, B., Trifonov, V., Shao, Z.: Intensional analysis of quantified types. ACM Trans. on Program. Lang. and Syst. 25, 159–209 (2003)

    Article  Google Scholar 

  48. 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)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics