skip to main content
10.1145/2951913.2951929acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Indexed codata types

Published:04 September 2016Publication History

ABSTRACT

Indexed data types allow us to specify and verify many interesting invariants about finite data in a general purpose programming language. In this paper we investigate the dual idea: indexed codata types, which allow us to describe data-dependencies about infinite data structures. Unlike finite data which is defined by constructors, we define infinite data by observations. Dual to pattern matching on indexed data which may refine the type indices, we define copattern matching on indexed codata where type indices guard observations we can make.

Our key technical contributions are three-fold: first, we extend Levy's call-by-push value language with support for indexed (co)data and deep (co)pattern matching; second, we provide a clean foundation for dependent (co)pattern matching using equality constraints; third, we describe a small-step semantics using a continuation-based abstract machine, define coverage for indexed (co)patterns, and prove type safety. This is an important step towards building a foundation where (co)data type definitions and dependent types can coexist.

References

  1. A. Abel and B. Pientka. Well-founded recursion with copatterns:a unified approach to termination and productivity. In 18th ACM International Conference on Functional Programming (ICFP ’13), pages 185–196. ACM Press, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. A. Abel, B. Pientka, D. Thibodeau, and A. Setzer. Copatterns: Programming infinite structures by observations. In 40th ACM Symp. on Principles of Programming Languages (POPL’13), pages 27–38. ACM Press, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Agda team. The Agda Wiki, 2014.Google ScholarGoogle Scholar
  4. D. Baelde. Least and greatest fixed points in linear logic. ACM Transactions on Computational Logic, 13(1):2:1–2:44, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Baelde, Z. Snow, and D. Miller. Focused inductive theorem proving. In J. Giesl and R. Haehnle, editors, 5th International Joint Conference on Automated Reasoning (IJCAR’10), Lecture Notes in Artificial Intelligence (LNAI 6173), pages 278–292. Springer, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. D. Baelde, K. Chaudhuri, A. Gacek, D. Miller, G. Nadathur, A. Tiu, and Y. Wang. Abella: A system for reasoning about relational specifications. Journal of Formalized Reasoning, 7(2):1–89, 2014.Google ScholarGoogle Scholar
  7. G. Betarte. Dependent Record Types and Formal Abstract Reasoning: Theory and practice. PhD thesis, Department of Computing Science, Chalmers University of Technology and University of Göteborg, 1998.Google ScholarGoogle Scholar
  8. E. Brady, C. McBride, and J. McKinna. Inductive families need not store their indices. In Types for Proofs and Programs (TYPES’03), Revised Selected Papers, Lecture Notes in Computer Science (LNCS 3085), pages 115–129, 2004.Google ScholarGoogle Scholar
  9. A. Cave and B. Pientka. Programming with binders and indexed datatypes. In 39th ACM Symposium on Principles of Programming Languages (POPL’12), pages 413–424. ACM Press, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Cheney and R. Hinze. First-class phantom types. Technical Report CUCIS TR2003-1901, Cornell University, 2003.Google ScholarGoogle Scholar
  11. R. Cockett and T. Fukushima. About charity. Technical report, Department of Computer Science, The University of Calgary, June 1992. Yellow Series Report No. 92/480/18. R. DeLine and M. Fähndrich. Typestates for objects. In 18th European Conference on Object-Oriented Programming (ECOOP 2004), Lecture Notes in Computer Science (LNCS 3086), pages 465–490. Springer, 2004.Google ScholarGoogle Scholar
  12. H. Goguen, C. McBride, and J. McKinna. Eliminating dependent pattern matching. In K. Futatsugi, J.-P. Jouannaud, and J. Meseguer, editors, Algebra, Meaning, and Computation, Essays Dedicated to Joseph A. Goguen on the Occasion of His 65th Birthday, Lecture Notes in Computer Science (LNCS 4060), pages 521–540. Springer, 2006.Google ScholarGoogle Scholar
  13. T. Hagino. A typed lambda calculus with categorical type constructors. In D. H. Pitt, A. Poigné, and D. E. Rydeheard, editors, Category Theory and Computer Science, Lecture Notes in Computer Science (LNCS 283), pages 140–157. Springer, 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. P. Hancock and A. Setzer. Interactive programs and weakly final coalgebras in dependent type theory. In L. Crosilla and P. Schuster, editors, From Sets and Types to Topology and Analysis. Towards Practicable Foundations for Constructive Mathematics, pages 115 – 134, Oxford, 2005. Clarendon Press.Google ScholarGoogle Scholar
  15. R. Harper, F. Honsell, and G. Plotkin. A framework for defining logics. Journal of the ACM, 40(1):143–184, January 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. N. R. Krishnaswami. Focusing on pattern matching. In 36th Annual ACM Symposium on Principles of Programming Languages (POPL’09), pages 366–378. ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. P. B. Levy. Call-by-push-value. PhD thesis, Queen Mary and Westfield College, University of London, 2001.Google ScholarGoogle Scholar
  18. D. R. Licata, N. Zeilberger, and R. Harper. Focusing on binding and computation. In F. Pfenning, editor, 23rd Symposium on Logic in Computer Science, pages 241–252. IEEE Computer Society Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. C. McBride. Let’s see how things unfold: Reconciling the infinite with the intensional. In A. Kurz, M. Lenisa, and A. Tarlecki, editors, 3rd Int. Conf. on Algebra and Coalgebra in Computer Science (CALCO’09), Lecture Notes in Computer Science (LNCS 5728), pages 113–126. Springer, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. R. Milner and M. Tofte. Co-induction in relational semantics. Theoretical Computer Science, 87(1):209 – 220, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. U. Norell. Towards a practical programming language based on dependent type theory. PhD thesis, Department of Computer Science and Engineering, Chalmers University of Technology, Sept. 2007. Technical Report 33D. B. Pientka and J. Dunfield. Programming with proofs and explicit contexts. In ACM Symposium on Principles and Practice of Declarative Programming (PPDP’08), pages 163–173. ACM Press, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. D. Thibodeau, A. Cave, and B. Pientka. Indexed codata (extended version). Technical report, School of Computer Science, McGill University, July 2016. Techincal Report. C. Tuckey. Pattern matching in Charity. Master’s thesis, The University of Calgary, July 1997.Google ScholarGoogle Scholar
  23. H. Xi. Applied type system. In Types for Proofs and Programs (TYPES’03), Revised Selected Papers, Lecture Notes in Computer Science (LNCS 3085), pages 394–408. Springer, 2004.Google ScholarGoogle Scholar
  24. H. Xi and F. Pfenning. Dependent types in practical programming. In 26th ACM Symposium on Principles of Programming Languages (POPL’99), pages 214–227. ACM Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. H. Xi, C. Chen, and G. Chen. Guarded recursive datatype constructors. In 30th ACM Symposium on Principles of Programming Languages (POPL’03), pages 224–235. ACM Press, 2003.. N. Zeilberger. On the unity of duality. Annals of Pure and Applied Logic, 153(1-3):66–96, 2008a. N. Zeilberger. Focusing and higher-order abstract syntax. In 35th Annual ACM Symposium on Principles of Programming Languages (POPL’08), pages 359–369. ACM Press, 2008b. C. Zenger. Indexed types. Theoretical Computer Science, 187(1-2):147–165, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Indexed codata types

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in
            • Published in

              cover image ACM Conferences
              ICFP 2016: Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming
              September 2016
              501 pages
              ISBN:9781450342193
              DOI:10.1145/2951913

              Copyright © 2016 ACM

              Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

              Publisher

              Association for Computing Machinery

              New York, NY, United States

              Publication History

              • Published: 4 September 2016

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article

              Acceptance Rates

              Overall Acceptance Rate333of1,064submissions,31%

              Upcoming Conference

              ICFP '24

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader