skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

Generic zero-cost reuse for dependent types

Published:30 July 2018Publication History
Skip Abstract Section

Abstract

Dependently typed languages are well known for having a problem with code reuse. Traditional non-indexed algebraic datatypes (e.g. lists) appear alongside a plethora of indexed variations (e.g. vectors). Functions are often rewritten for both non-indexed and indexed versions of essentially the same datatype, which is a source of code duplication.

We work in a Curry-style dependent type theory, where the same untyped term may be classified as both the non-indexed and indexed versions of a datatype. Many solutions have been proposed for the problem of dependently typed reuse, but we exploit Curry-style type theory in our solution to not only reuse data and programs, but do so at zero-cost (without a runtime penalty). Our work is an exercise in dependently typed generic programming, and internalizes the process of zero-cost reuse as the identity function in a Curry-style theory.

Skip Supplemental Material Section

Supplemental Material

a104-diehl.webm

References

  1. Bruno Barras and Bruno Bernardo. 2008. The implicit calculus of constructions as a programming language with dependent types. Foundations of Software Science and Computational Structures (2008), 365–379. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Jean-Philippe Bernardy and Moulin Guilhem. 2013. Type-theory in Color. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP ’13). ACM, New York, NY, USA, 61–72. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Edwin Brady. 2013. Idris, a general-purpose dependently typed programming language: Design and implementation. Journal of Functional Programming 23, 05 (2013), 552–593.Google ScholarGoogle ScholarCross RefCross Ref
  4. Joachim Breitner, Richard A. Eisenberg, Simon Peyton Jones, and Stephanie Weirich. 2016. Safe zero-cost coercions for Haskell. J. Funct. Program. 26 (2016), e15.Google ScholarGoogle ScholarCross RefCross Ref
  5. Pierre-Evariste Dagand and Conor McBride. 2012. Transporting Functions Across Ornaments. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming (ICFP ’12). ACM, New York, NY, USA, 103–114. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Pierre-Evariste Dagand, Nicolas Tabareau, and Éric Tanter. 2016. Partial Type Equivalences for Verified Dependent Interoperability. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016). ACM, New York, NY, USA, 298–310. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Pierre-Evariste Dagand, Nicolas Tabareau, and Éric Tanter. 2018. Foundations of dependent interoperability. Journal of Functional Programming 28 (2018).Google ScholarGoogle Scholar
  8. Leonardo de Moura, Soonho Kong, Jeremy Avigad, Floris Van Doorn, and Jakob von Raumer. 2015. The Lean theorem prover (system description). In International Conference on Automated Deduction. Springer, 378–388.Google ScholarGoogle ScholarCross RefCross Ref
  9. Larry Diehl and Aaron Stump. 2018. Zero-Cost Coercions for Program and Proof Reuse. (2018). arXiv: 1802.00787Google ScholarGoogle Scholar
  10. Denis Firsov, Richard Blair, and Aaron Stump. 2018. Efficient Mendler-Style Lambda-Encodings in Cedille. In Interactive Theorem Proving - 9th International Conference, ITP 2018, Held as Part of the Federated Logic Conference, FloC 2018, Oxford, UK, July 9-12, 2018, Proceedings. 235–252.Google ScholarGoogle Scholar
  11. Denis Firsov and Aaron Stump. 2018. Generic Derivation of Induction for Impredicative Encodings in Cedille. In Certified Programs and Proofs (CPP), June Andronick and Amy Felty (Eds.). Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Matthew Flatt and PLT. 2010. Reference: Racket. Technical Report PLT-TR-2010-1. PLT Design Inc. https://racket-lang.org/tr1/ .Google ScholarGoogle Scholar
  13. Herman Geuvers. 2001. Induction Is Not Derivable in Second Order Dependent Type Theory. In Typed Lambda Calculi and Applications (TLCA). 166–181. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Hsiang-Shang Ko and Jeremy Gibbons. 2013. Relational algebraic ornaments. In Proceedings of the 2013 ACM SIGPLAN workshop on Dependently-typed programming. ACM, 37–48. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Alexei Kopylov. 2003. Dependent Intersection: A New Way of Defining Records in Type Theory. In 18th IEEE Symposium on Logic in Computer Science (LICS). 86–95. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Conor McBride. 2011. Ornamental algebras, algebraic ornaments. (2011).Google ScholarGoogle Scholar
  17. Conor McBride and James McKinna. 2004. The view from the left. Journal of functional programming 14, 1 (2004), 69–111. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Alexandre Miquel. 2001. The Implicit Calculus of Constructions Extending Pure Type Systems with an Intersection Type Binder and Subtyping. In Typed Lambda Calculi and Applications (TLCA), Samson Abramsky (Ed.). 344–359. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Ulf Norell. 2007. Towards a practical programming language based on dependent type theory. Ph.D. Dissertation. Chalmers University of Technology.Google ScholarGoogle Scholar
  20. Ulf Norell. 2008. Dependently typed programming in Agda. In International School on Advanced Functional Programming. Springer, 230–266. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Aaron Stump. 2017. The calculus of dependent lambda eliminations. J. Funct. Program. 27 (2017), e14.Google ScholarGoogle ScholarCross RefCross Ref
  22. Aaron Stump. 2018a. From Realizability to Induction via Dependent Intersection. Ann. Pure Appl. Logic (2018). to appear.Google ScholarGoogle Scholar
  23. Aaron Stump. 2018b. Syntax and Semantics of Cedille. (2018). arXiv: 1806.04709Google ScholarGoogle Scholar
  24. The Coq Development Team. 2008. The Coq Proof Assistant Reference Manual. http://coq.inria.frGoogle ScholarGoogle Scholar
  25. J. B. Wells. 1999. Typability and Type Checking in System F are Equivalent and Undecidable. Ann. Pure Appl. Logic 98, 1-3 (1999), 111–156.Google ScholarGoogle ScholarCross RefCross Ref

Index Terms

  1. Generic zero-cost reuse for dependent 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

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!