A Datastructure for Iterated Powers

  • Ralph Matthes
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4014)


Bushes are considered as the first example of a truly nested datatype, i. e., a family of datatypes indexed over all types where a constructor argument not only calls this family with a changing index but even with an index that involves the family itself. For the time being, no induction principles for these datatypes are known. However, the author has introduced with Abel and Uustalu (TCS 333(1–2), pp. 3–66, 2005) iteration schemes that guarantee to define only terminating functions on those datatypes.

The article uses a generalization of Bushes to n-fold self-application and shows how to define elements of these types that have a number of data entries that is obtained by iterated raising to the power of n. Moreover, the data entries are just all the n-branching trees up to a certain height.

The real question is how to extract this list of trees from that complicated data structure and to prove this extraction correct. Here, we use the “refined conventional iteration” from the cited article for the extraction and describe a verification that has been formally verified inside Coq with its predicative notion of set.


Iteration Scheme Recursive Call Type Transformation Termination Guarantee Container Type 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abbott, M., Altenkirch, T., Ghani, N.: Containers: Constructing strictly positive types. Theor. Comput. Sci. 342(1), 3–27 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  2. 2.
    Abel, A., Matthes, R. (Co-)Iteration for higher-order nested datatypes. In: Geuvers, H., Wiedijk, F. (eds.) TYPES 2002. LNCS, vol. 2646, pp. 1–20. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  3. 3.
    Abel, A., Matthes, R., Uustalu, T.: Generalized iteration and coiteration for higher-order nested datatypes. In: Gordon, A.D. (ed.) FOSSACS 2003. LNCS, vol. 2620, pp. 54–69. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  4. 4.
    Abel, A., Matthes, R., Uustalu, T.: Iteration and coiteration schemes for higher-order and nested datatypes. Theor. Comput. Sci. 333(1-2), 3–66 (2005)zbMATHCrossRefMathSciNetGoogle Scholar
  5. 5.
    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)CrossRefGoogle Scholar
  6. 6.
    Bertot, Y., Castéran, P.: Interactive Theorem Proving and Program Development. In: Coq’Art: The Calculus of Inductive Constructions. Springer, Heidelberg (2004)Google Scholar
  7. 7.
    Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  8. 8.
    Bird, R., Paterson, R.: Generalised folds for nested datatypes. Formal Aspects of Comput. 11(2), 200–222 (1999)zbMATHCrossRefGoogle Scholar
  9. 9.
    Bird, R.S., Paterson, R.: De Bruijn notation as a nested datatype. J. of Functional Programming 9(1), 77–91 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Girard, J.-Y.: Interprétation fonctionnelle et élimination des coupures dans l’arithmétique d’ordre supérieur. Doctorat d’État. Université de Paris VII (1972)Google Scholar
  11. 11.
    Hinze, R.: Polytypic values possess polykinded types. In: Backhouse, R., Oliveira, J.N. (eds.) MPC 2000. LNCS, vol. 1837, pp. 2–27. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  12. 12.
    Hinze, R.: Efficient generalized folds. In: Jeuring, J. (ed.) Proc. of 2nd Wksh. on Generic Programming, WGP 2000, Univ. Utrecht (2000)Google Scholar
  13. 13.
    Hinze, R.: Generalizing generalized tries. J. of Funct. Program. 10(4), 327–351 (2000)zbMATHCrossRefMathSciNetGoogle Scholar
  14. 14.
    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)CrossRefGoogle Scholar
  15. 15.
    Hoogendijk, P.F., de Moor, O.: Container types categorically. J. of Funct. Program. 10(2), 91–225 (2000)Google Scholar
  16. 16.
    Löh, A.: Exploring Generic Haskell. Proefschrift (PhD thesis). Institute for Programming Research and Algorithmics, Universiteit Utrecht, 331 pages (2004)Google Scholar
  17. 17.
    Martin, C., Gibbons, J., Bayley, I.: Disciplined, efficient, generalised folds for nested datatypes. Formal Aspects of Comput. 16(1), 19–35 (2004)zbMATHCrossRefGoogle Scholar
  18. 18.
    Matthes, R.: Coq development for A Datastructure for Iterated Powers (2006),
  19. 19.
    McBride, C.: Elimination with a motive. In: Callaghan, P., Luo, Z., McKinna, J., Pollack, R. (eds.) TYPES 2000. LNCS, vol. 2277, pp. 197–216. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  20. 20.
    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)CrossRefGoogle Scholar
  21. 21.
    Oury, N.: Extensionality in the calculus of constructions. In: Hurd, J., Melham, T. (eds.) TPHOLs 2005. LNCS, vol. 3603, pp. 278–293. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  22. 22.
    Rodriguez, D.: Verification of (co)iteration schemes for nested datatypes in Coq. Student project, Inst. für Informatik, LMU München (2006), Available from:
  23. 23.
    The Coq Development Team: The Coq Proof Assistant Reference Manual Version 8.0. Project LogiCal, INRIA (2005), System, available from:
  24. 24.
    Wadler, P.: Theorems for free! In: Proc. of 4th Int. Conf. on Functional Programming Languages and Computer Architecture, FPCA 1989, pp. 347–359. ACM Press, New York (1989)CrossRefGoogle Scholar
  25. 25.
    Xi, H.: Dependent Types in Practical Programming. PhD thesis, Carnegie Mellon University (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Ralph Matthes
    • 1
  1. 1.Institut de Recherche en Informatique de Toulouse (IRIT)C. N. R. S. et Université Paul Sabatier (Toulouse III)ToulouseFrance

Personalised recommendations