Skip to main content

Coalgebras as Types Determined by Their Elimination Rules

  • Chapter
  • First Online:
Book cover Epistemology versus Ontology

Part of the book series: Logic, Epistemology, and the Unity of Science ((LEUS,volume 27))

Abstract

We develop rules for coalgebras in type theory, and give meaning explanations for them. We show that elements of coalgebras are determined by their elimination rules, whereas the introduction rules can be considered as derived. This is in contrast with algebraic data types, for which the opposite is true: elements are determined by their introduction rules, and the elimination rules can be considered as derived. In this sense, the function type from the logical framework is more like a coalgebraic data type, the elements of which are determined by the elimination rule. We illustrate why the simplest form of guarded recursion is nothing but the introduction rule originating from the formulation of coalgebras in category theory. We discuss restrictions needed in order to preserve decidability of equality.

Supported by EPSRC grant EP/G033374/1

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 169.00
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 219.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 219.99
Price excludes VAT (USA)
  • Durable hardcover 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

References

  • Aczel, P. 1988. Non-wellfounded set theory, CSLI lecture notes, vol. 14, xx+137. Stanford: Stanford University, Center for the Study of Language and Information.

    Google Scholar 

  • Agda. 2011 Email list archive. Available at https://lists.chalmers.se/pipermail/agda/.

  • Altenkirch, T. 2004. Codata. Talk given at the TYPES workshop in Jouy-en-Josas. Available from http://www.cs.nott.ac.uk/~txa/talks/types04.pdf, Dec 2004.

  • Altenkirch, T., and N.A. Danielsson. 2010. Termination checking nested inductive and coinductive types. In Proceedings of workshop on partiality and recursion in interactive theorem provers, PAR’10, Edinburgh.

    Google Scholar 

  • Bertot, Y. 2006. CoInduction in Coq. Available from http://arxiv.org/abs/cs/0603119, Mar 2006.

  • Bertot, Y., and P. Castéran. 2004. Interactive theorem proving and program development. Coq’Art: The calculus of inductive constructions. Berlin/New York: Springer.

    Google Scholar 

  • Cockett, J., and D. Spencer. 1992. Strong categorical datatypes I. In Category theory 1991: proceedings of an international summer category theory meeting, held June 23–30, 1991, vol. 13, ed. R.A.G. Seely, 141. Providence: American Mathematical Society.

    Google Scholar 

  • Cockett, J.R.B., and D. Spencer. 1995. Strong categorical datatypes II: A term logic for categorical programming. Theoretical Computer Science 139(1–2): 69–113.

    Article  Google Scholar 

  • Cockett, R., and T. Fukushima. 1992. About charity. Technical report, Department of Computer Science, The University of Calgary, June 1992. Yellow series report no. 92/480/18.

    Google Scholar 

  • Coquand, T. 1994. Infinite objects in type theory. In Types for proofs and programs, Lecture notes in computer science, vol. 806, ed. H. Barendregt and T. Nipkow, 62–78. Berlin: Springer

    Google Scholar 

  • Danielsson, N.A. 2008. Codata oddity. Email posted on the Agda email list. Available from http://thread.gmane.org/gmane.comp.lang.agda/226.

  • Díez, G.F. 2000. Five observations concerning the intended meaning of the intuitionistic logical constants. Journal of Philosophical Logic 29(4): 409–424.

    Article  Google Scholar 

  • Díez, G.F. 2002. The logic of constructivism. Disputatio 12: 37–41.

    Google Scholar 

  • Díez, G.F. 2003. Is the language of intuitionistic mathematics adequate for intuitionistic purposes? L&PS - Logic and Philosophy of Science 1(1).

    Google Scholar 

  • Dummett, M. 2000. Elements of intuitionism. Oxford logic guides, 2nd ed. New York: Oxford University Press.

    Google Scholar 

  • Dybjer, P., and A. Setzer. 2003. Induction–recursion and initial algebras. Annals of Pure and Applied Logic 124: 1–47.

    Article  Google Scholar 

  • Dybjer, P., and A. Setzer. 2006. Indexed induction–recursion. Journal of Logic and Algebraic Programming 66: 1–49, 2006.

    Google Scholar 

  • Giménez, C.E. 1996. Un calcul de constructions infinies et son application à la vérification de systèmes communicants. (English: A calculus of infinite constructions and its application to the verification of communicating systems). Ph.D. thesis, Ecole normale supérieure de Lyon, Lyon, France.

    Google Scholar 

  • Giménez, E. 1994. Codifying guarded definitions with recursive schemes. In Proceedings of the 1994 workshop on types for proofs and programs, Bastad, LNCS No. 996, 39–59. Springer.

    Google Scholar 

  • Hagino, T. 1987. A categorical programming language. Ph.D. thesis, Laboratory for Foundations of Computer Science, University of Edinburgh. Available from http://www.tom.sfc.keio.ac.jp/~hagino/thesis.pdf.

  • Hagino, T. 1989. Codatatypes in ml. Journal of Symbolic Computation 8(6): 629–650.

    Article  Google Scholar 

  • Hancock, P., and A. Setzer. 1999. The IO monad in dependent type theory. In Electronic proceedings of the workshop on dependent types in programming, Göteborg, 27–28, Mar 1999. Available at http://www.md.chalmers.se/Cs/Research/Semantics/APPSEM/dtp99.html.

  • Hancock, P., and A. Setzer. 2000a. Interactive programs in dependent type theory. In Computer science logic: 14th international workshop, CSL 2000. Lecture notes in computer science, Vol. 1862, ed. P. Clote and H. Schwichtenberg, 317–331. Berlin: Springer.

    Google Scholar 

  • Hancock, P., and A. Setzer. 2000b. Specifying interactions with dependent types. In Workshop on subtyping and dependent types in programming, Portugal, 7 July 2000. Electronic proceedings, available at http://www-sop.inria.fr/oasis/DTP00/Proceedings/proceedings.html.

  • Hancock, P., and A. Setzer. 2004. Interactive programs and weakly final coalgebras (extended version). In Dependently typed programming, ed. T. Altenkirch, M. Hofmann, and J. Hughes, number 04381 in Dagstuhl Seminar Proceedings. Internationales Begegnungs- und Forschungszentrum (IBFI), Schloss Dagstuhl, Germany. Available at http://drops.dagstuhl.de/opus/.

  • Hancock, P., and A. Setzer. 2005. Guarded induction and weakly final coalgebras in dependent type theory. In From sets and types to topology and analysis. Towards practicable foundations for constructive mathematics, ed. L. Crosilla and P. Schuster, 115–134, Oxford: Clarendon Press.

    Google Scholar 

  • Jacobs, B. 1995. Objects and classes, co-algebraically. In Object orientation with parallelism and persistence, ed. B. Freitag, C.B. Jones, C. Lengauer, and H.-J. Schek, 83–103. Boston: Kluwer.

    Google Scholar 

  • Jacobs, B. 1998. Coalgebraic reasoning about classes in object-oriented languages. Electronical Notes in Computer Science 11: 231–242. Special issue on the workshop coalgebraic methods in computer science (CMCS 1998).

    Google Scholar 

  • Jacobs, B. 1999. Categorical logic and type theory, Number 141 in studies in logic and the foundations of mathematics. Amsterdam: North Holland.

    Google Scholar 

  • Jacobs, B. 2005. Introduction to coalgebra. Towards mathematics of states and oberservations. Available at http://www.cs.ru.nl/B.Jacobs/CLG/JacobsCoalgebraIntro.pdf.

  • Jacobs, B., and J. Rutten. 1997. A tutorial on (co)algebras and (co)induction. EATCS Bulletin 62: 62–222.

    Google Scholar 

  • Leclerc, F., and C. Paulin-Mohring. Programming with streams in Coq. A case study: The sieve of eratosthenes. In Types for proofs and programs, Lecture notes in computer science, vol. 806, ed. H. Barendregt and T. Nipkow, 191–212. Berlin/Heidelberg: Springer.

    Google Scholar 

  • Martin-Löf, P. 1972. Infinite terms and a system of natural deduction. Compositio Mathematica 24(1): 93–103.

    Google Scholar 

  • Martin-Löf, P. 1984. Intuitionistic type theory. Naples: Bibliopolis.

    Google Scholar 

  • Martin-Löf, P. 1987. Truth of a proposition, evidence of a judgement, validity of a proof. Synthese 73: 407–420.

    Article  Google Scholar 

  • Martin-Löf, P. 1996. On the meaning of the logical constants and the justification of the logical laws. Nordic Journal of Philosophical Logic 1(1): 11–60.

    Google Scholar 

  • Martin-Löf, P. 1998. An intuitionistic theory of types. In Twenty-five years of constructive type theory, ed. G. Sambin and J. Smith, 127–172. Oxford: Oxford University Press. Reprinted version of an unpublished report from 1972.

    Google Scholar 

  • McBride, C. 2009. Let’s see how things unfold: Reconciling the infinite with the intensional. In Proceedings of the 3rd international conference on algebra and coalgebra in computer science, CALCO’09, Lecture notes in computer science, ed. A. Kurz, M. Lenisa, and A. Tarlecki, 113–126. Berlin/Heidelberg: Springer.

    Google Scholar 

  • Nanevski, A., F. Pfenning, and B. Pientka. 2008. Contextual modal type theory. ACM Transactions on Computational Logic 9:23:1–23:49.

    Google Scholar 

  • Nordström, B., K. Petersson, and J.M. Smith. 1990. Programming in Martin-Löf’s type theory: An introduction. New York: Oxford University Press.

    Google Scholar 

  • Norell, U. 2007. Towards a practical programming language based on dependent type theory. Ph.D. thesis, Department of Computer Science and Engineering, Chalmers University of Technology, SE-412 96 Göteborg.

    Google Scholar 

  • Oury, N. 2008. Coinductive types and type preservation. Email posted 6 June 2008 at science.mathematics.logic.coq.club. Available at https://sympa-roc.inria.fr/wws/arc/coq-club/2008-06/msg00022.html?checked_cas=2.

  • Paulson, L. 1994. A fixedpoint approach to implementing (Co) inductive definitions. In Automated deduction CADE-12, Lecture notes in computer science, vol. 814, ed. A. Bundy, 148–161. Berlin/Heidelberg: Springer.

    Google Scholar 

  • Setzer, A. 2008. Universes in type theory part I – Inaccessibles and Mahlo. In Logic colloquium ’04, Lecture notes in logic 29, ed. A. Andretta, K. Kearnes, and D. Zambella, Association of Symbolic Logic, 123–156. Cambridge: Cambridge University Press.

    Google Scholar 

  • Setzer, A. 2011. Why codata should be replaced by coalgebras. In preparation.

    Google Scholar 

  • Sundholm, G. 1983. Constructions, proofs and the meaning of logical constants. Journal of Philosophical Logic 12: 151–172. 10.1007/BF00247187.

    Article  Google Scholar 

  • Telford, A. and D. Turner. 1997. Ensuring streams flow. In Algebraic methodology and software technology: 6th international conference, AMAST’96 Sydney, December 13 – 17, 1997, Lecture notes in computer science, ed. M. Johnson, 509–523, 1349. Berlin: Springer.

    Google Scholar 

  • Turner, D. 1995. Elementary strong functional programming. Funtional Programming Languages in Education 1–13.

    Google Scholar 

  • Turner, D.A. 2004. Total functional programming. Journal of Universal Computer Science 10(7): 751–768.

    Google Scholar 

Download references

Acknowledgements

We want to thank the anonymous referee for valuable comments on earlier version of this articles. We want to thank as well our PhD student Fredrik Nordvall Forsberg for diligent proof reading and valuable remarks.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Anton Setzer .

Editor information

Editors and Affiliations

Additional information

Dedicated to Per Martin-Löf on the occasion of his retirement.

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer Science+Business Media Dordrecht.

About this chapter

Cite this chapter

Setzer, A. (2012). Coalgebras as Types Determined by Their Elimination Rules. In: Dybjer, P., Lindström, S., Palmgren, E., Sundholm, G. (eds) Epistemology versus Ontology. Logic, Epistemology, and the Unity of Science, vol 27. Springer, Dordrecht. https://doi.org/10.1007/978-94-007-4435-6_16

Download citation

Publish with us

Policies and ethics