Subtyping, Declaratively

An Exercise in Mixed Induction and Coinduction
  • Nils Anders Danielsson
  • Thorsten Altenkirch
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6120)


It is natural to present subtyping for recursive types coinductively. However, Gapeyev, Levin and Pierce have noted that there is a problem with coinductive definitions of non-trivial transitive inference systems: they cannot be “declarative”—as opposed to “algorithmic” or syntax-directed—because coinductive inference systems with an explicit rule of transitivity are trivial.

We propose a solution to this problem. By using mixed induction and coinduction we define an inference system for subtyping which combines the advantages of coinduction with the convenience of an explicit rule of transitivity. The definition uses coinduction for the structural rules, and induction for the rule of transitivity. We also discuss under what conditions this technique can be used when defining other inference systems.

The developments presented in the paper have been mechanised using Agda, a dependently typed programming language and proof assistant.


Inference System Decision Procedure Recursive Call Admissible Rule Stream Processor 
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. Abel, A.: Mixed inductive/coinductive types and strong normalization. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 286–301. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  2. Abel, A., Altenkirch, T.: A predicative analysis of structural recursion. Journal of Functional Programming 12(1), 1–41 (2002)zbMATHCrossRefMathSciNetGoogle Scholar
  3. The Agda Team. The Agda Wiki (2010),
  4. Amadio, R.M., Cardelli, L.: Subtyping recursive types. ACM Transactions on Programming Languages and Systems 15(4), 575–631 (1993)CrossRefGoogle Scholar
  5. Barthe, G., Frade, M.J., Giménez, E., Pinto, L., Uustalu, T.: Type-based termination of recursive definitions. Mathematical Structures in Computer Science 14(1), 97–141 (2004)zbMATHCrossRefMathSciNetGoogle Scholar
  6. Barwise, J.: Mixed Fixed Points. In: The Situation in Logic. CSLI Lecture Notes, vol. 17, Center for the Study of Language and Information, Leland Stanford Junior University (1989)Google Scholar
  7. Bradfield, J., Stirling, C.: Modal mu-calculi. In: Handbook of Modal Logic. Studies in Logic and Practical Reasoning, vol. 3. Elsevier, Amsterdam (2007)CrossRefGoogle Scholar
  8. Brandt, M., Henglein, F.: Coinductive axiomatization of recursive type equality and subtyping. Fundamenta Informaticae 33(4), 309–338 (1998)zbMATHMathSciNetGoogle Scholar
  9. Capretta, V.: General recursion via coinductive types. Logical Methods in Computer Science 1(2), 1–28 (2005)CrossRefMathSciNetGoogle Scholar
  10. Coquand, T.: Infinite objects in type theory. In: Barendregt, H., Nipkow, T. (eds.) TYPES 1993. LNCS, vol. 806, pp. 62–78. Springer, Heidelberg (1994)Google Scholar
  11. Cousot, P., Cousot, R.: Inductive definitions, semantics and abstract interpretations. In: POPL ’92, Proceedings of the 19th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pp. 83–94 (1992)Google Scholar
  12. Danielsson, N.A.: Code accompanying the paper (2010a),
  13. Danielsson, N.A.: Beating the productivity checker using embedded languages. Draft (2010b)Google Scholar
  14. Danielsson, N.A., Altenkirch, T.: Mixing induction and coinduction. Draft (2009)Google Scholar
  15. de Vries, E.: Re: [Coq-Club] Adding (inductive) transitivity to weak bisimilarity not sound? (was: Need help with coinductive proof). Message to the Coq-Club mailing list (August 2009)Google Scholar
  16. Gapeyev, V., Levin, M.Y., Pierce, B.C.: Recursive subtyping revealed. Journal of Functional Programming 12(6), 511–548 (2002)zbMATHCrossRefMathSciNetGoogle Scholar
  17. Gibbons, J., Hutton, G.: Proof methods for corecursive programs. Fundamenta Informaticae 66(4), 353–366 (2005)zbMATHMathSciNetGoogle Scholar
  18. Giménez, E.: Un Calcul de Constructions Infinies et son Application à la Vérification de Systèmes Communicants. PhD thesis, Ecole Normale Supérieure de Lyon (1996)Google Scholar
  19. Gordon, A.D.: Bisimilarity as a theory of functional programming. Theoretical Computer Science 228(1-2), 5–47 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  20. Hagino, T.: A Categorical Programming Language. PhD thesis, University of Edinburgh (1987)Google Scholar
  21. Hancock, P., Pattinson, D., Ghani, N.: Representations of stream processors using nested fixed points. Logical Methods in Computer Science 5(3:9) (2009)Google Scholar
  22. Hensel, U., Jacobs, B.: Proof principles for datatypes with iterated recursion. In: Moggi, E., Rosolini, G. (eds.) CTCS 1997. LNCS, vol. 1290, pp. 220–241. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  23. Hughes, J., Moran, A.: Making choices lazily. In: FPCA ’95, Proceedings of the seventh international conference on Functional programming languages and computer architecture, pp. 108–119 (1995)Google Scholar
  24. Kozen, D., Palsberg, J., Schwartzbach, M.I.: Efficient recursive subtyping. Mathematical Structures in Computer Science 5(1), 113–125 (1995)zbMATHCrossRefMathSciNetGoogle Scholar
  25. Leroy, X., Grall, H.: Coinductive big-step operational semantics. Information and Computation 207(2), 284–304 (2009)zbMATHCrossRefMathSciNetGoogle Scholar
  26. Levy, P.B.: Infinitary Howe’s method. In: Proceedings of the Eighth Workshop on Coalgebraic Methods in Computer Science (CMCS 2006). ENTCS, vol. 164, pp. 85–104 (2006)Google Scholar
  27. Mendler, P.F.: Inductive Definition in Type Theory. PhD thesis, Cornell University (1988)Google Scholar
  28. Milner, R.: Operational and algebraic semantics of concurrent processes. In: Handbook of Theoretical Computer Science, Volume B: Formal Models and Semantics. The MIT Press and Elsevier (1990)Google Scholar
  29. Milner, R., Tofte, M.: Co-induction in relational semantics. Theoretical Computer Science 87(1), 209–220 (1991)zbMATHCrossRefMathSciNetGoogle Scholar
  30. Müller, O., Nipkow, T., von Oheimb, D., Slotosch, O.: HOLCF = HOL + LCF. Journal of Functional Programming 9(2), 191–223 (1999)zbMATHCrossRefMathSciNetGoogle Scholar
  31. Nakata, K., Uustalu, T.: Trace-based coinductive operational semantics for While; Big-step and small-step, relational and functional styles. In: Urban, C. (ed.) TPHOLs 2009. LNCS, vol. 5674, pp. 375–390. Springer, Heidelberg (2009)CrossRefGoogle Scholar
  32. Norell, U.: Towards a practical programming language based on dependent type theory. PhD thesis, Chalmers University of Technology and Göteborg University (2007)Google Scholar
  33. Park, D.: On the semantics of fair parallelism. In: Bjorner, D. (ed.) Abstract Software Specifications. LNCS, vol. 86, pp. 504–526. Springer, Heidelberg (1980)Google Scholar
  34. Raffalli, C.: L’Arithmétique Fonctionnelle du Second Ordre avec Points Fixes. PhD thesis, Université Paris VII (1994)Google Scholar
  35. Sangiorgi, D., Milner, R.: The problem of “weak bisimulation up to”. In: Cleaveland, W.R. (ed.) CONCUR 1992. LNCS, vol. 630, pp. 32–46. Springer, Heidelberg (1992)CrossRefGoogle Scholar
  36. Turner, D.A.: Total functional programming. Journal of Universal Computer Science 10(7), 751–768 (2004)MathSciNetGoogle Scholar
  37. Wadler, P., Taha, W., MacQueen, D.: How to add laziness to a strict language, without even being odd. In: Proceedings of the 1998 ACM SIGPLAN Workshop on ML (1998)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Nils Anders Danielsson
    • 1
  • Thorsten Altenkirch
    • 1
  1. 1.University of Nottingham 

Personalised recommendations