skip to main content
10.1145/292540.292560acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article
Free Access

Dependent types in practical programming

Authors Info & Claims
Published:01 January 1999Publication History

ABSTRACT

We present an approach to enriching the type system of ML with a restricted form of dependent types, where type index objects are drawn from a constraint domain C, leading to the DML(C) language schema. This allows specification and inference of significantly more precise type information, facilitating program error detection and compiler optimization. A major complication resulting from introducing dependent types is that pure type inference for the enriched system is no longer possible, but we show that type-checking a sufficiently annotated program in DML(C) can be reduced to constraint satisfaction in the constraint domain C. We exhibit the unobtrusiveness of our approach through practical examples and prove that DML(C) is conservative over ML. The main contribution of the paper lies in our language design, including the formulation of type-checking rules which makes the approach practical. To our knowledge, no previous type system for a general purpose programming language such as ML has combined dependent types with features including datatype declarations, higher-order functions, general recursions, let-polymorphism, mutable references, and exceptions. In addition, we have finished a prototype implementation of DML(C) for an integer constraint domain C, where constraints are linear inequalities (Xi and Pfenning 1998).

References

  1. Augustsson, L. (1998). Cayenne - a language with dependent types. In Proceedings of A CM SIGPLAN International Conference on Functional Programming, pp. 239-250.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Constable, It. L. et al. (1986). Implementing Mathematics with the Nuprl Proof Development System. Englewood Cliffs, New Jersey: Prentice-Hall.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Danvy, O. (1998, May). Functional unparsing. Technical Report RS-98-12, University of Aarhus.]]Google ScholarGoogle Scholar
  4. Dowek, G., A. Felty, H. Herbelin, G. Huet, C. Murthy, C. Parent, C. Paulin-Mohring, and B. Werner (1993). The Coq proof assistant user's guide. Rapport Techniques 154, IN- RIA, Rocquencourt, France. Version 5.8.]]Google ScholarGoogle Scholar
  5. Freeman, T. and F. Pfenning (1991). Refinement types for ML. In A CM SIGPLAN Conference on Programming Language Design and Implementation, Toronto, Ontario, pp. 268- 277.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Harper, It. W., F. Honsell, and G. D. Plotkin (1993, January). A framework for defining logics. Journal o/the A CM ~ 0 (1), 143-184.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Hayashi, S. and H. Nakano (1988). PX: A Computational Logic. The MIT Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Hudak, P., S. L. Peyton Jones, and P. Wadler (1992, May). Report on the programming language Haskell, a non-strict purely-functional programming language, Version 1.2. SIG- PLAN Notices ~7(5).]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Hughes, J., L. Pareto, and A. Sabry (1996). Proving the correctness of reactive systems using sized types. In Conference Record o/P3rd A CM SIGPLAN-SIGA CT Symposium on Principles of Programming Languages, pp. 410-423.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Jay, C. and M. Sekanina (1996). Shape checking of array programs. Technical Report 96.09, University of Technology, Sydney, Australia.]]Google ScholarGoogle Scholar
  11. Kreitz, C., M. Hayden, and J. Hickey (1998, July). A proof environment for the development of group communication systems. In H. Kirchner and C. Kirchner (Eds.), 15th International Conference on Automated Deduction, LNAI 1421, Lindau, Germany, pp. 317-332. Springer-Verlag.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Milner, R., M. Tofte, and R. W. Harper (1990). The Definition o.f Standard ML. Cambridge, Massachusetts: MIT Press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Moggi, E. (1989). Computational lambda-calculus and monads. In Proceedings Fourth Annual Symposium on Logic in Computer Science, pp. 14-23.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Necula, G. (1997). Proof-carrying code. In Conference Record of 2~th Annual A CM Symposium on Principles of Programming Languages, pp. 106-119. ACM press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Necula, G. and P. Lee (1998, June). The design and implementation of a certifying compiler. In A CM SIGPLAN '98 Conference on Programming Language Design and Implementation, pp. 333-344. ACM press.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Owre, S., S. Rajan, J. Rushby, N. Shankar, and M. Srivas (1996, July/August). PVS: Combining specification, proof checking, and model checking. In R. Alur and T. A. Henzinger (Eds.), Proceedings o.f the 8th International Conference on Computer-Aided Verification, CA V '96, New Brunswick, NJ, pp. 411-414. Springer-Verlag LNCS 1102.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Parent, C. (1995). Synthesizing proofs from programs in the calculus of inductive constructions. In Proceedings o/the International Conference on Mathematics for Programs Constructions. Springer-Verlag LNCS 947.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Pierce, B. and D. Turner (1998). Local type inference. In Proceedings o~ the 25th Annual A CM SIGPLAN-SIGA CT Symposium on Principles o.f Programming Languages, pp. 252-265.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Sabry, A. and M. Felleisen (1993). Reasoning about programs in continuation-passing style. LISP and Symbolic Computation 6(3/4), 289-360.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Sannella, D. and A. Tarlecki (1989, February). Toward formal development of ML programs: Foundations and methodology. Technical Report ECS-LFCS-89-71, Laboratory for Foundations of Computer Science, Depatment of Computer Science, University of Edinburgh.]]Google ScholarGoogle Scholar
  21. Sulzmann, M., M. Odersky, and M. Wehr (1997). Type inference with constrained types. In Proceedings of 4th International Workshop on Foundations o~ Object-Oriented Languages.]]Google ScholarGoogle Scholar
  22. Weis, P. and X. Leroy (1993). Le langage Carol. Paris: InterEditions.]]Google ScholarGoogle Scholar
  23. Xi, H. (1997, November). Some examples of DML programming. Available at ht tp : //www. cs. cmu. edu/'hwxi/DbIL/oxamplos 1.]]Google ScholarGoogle Scholar
  24. H. (1998). Dependent Types in Practical Programming. Ph. D. thesis, Carnegie Mellon University. pp. viii+189. Forthcoming. The current version is available as http : //www. ~ s. cmu. edu/" hwxi/DML/thes is. ps.]]Google ScholarGoogle Scholar
  25. Xi, H. (1999, January). Dead code elimination through dependent types. In The First International Workshop on Practical Aspects of Declarative Languages, San Antonio, Texas. To appear.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Xi, H. and F. Pfenning (1998, June). Eliminating array bound checking through dependent types. In Proceedings of A CM SIGPLAN Conference on Programming Language Design and Implementation, pp. 249-257.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Zenger, C. (1997). indexed types. Theoretical Computer Science 187, 147-165.]] Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Zenger, C. (1998). Indizierte Typen. Ph. D. thesis, Fakultgt fiir Informatik, Universitgt Karlsruhe. Forthcoming.]]Google ScholarGoogle Scholar

Index Terms

  1. Dependent types in practical programming

          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
            POPL '99: Proceedings of the 26th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
            January 1999
            324 pages
            ISBN:1581130953
            DOI:10.1145/292540

            Copyright © 1999 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 ACM 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: 1 January 1999

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • Article

            Acceptance Rates

            POPL '99 Paper Acceptance Rate24of136submissions,18%Overall Acceptance Rate824of4,130submissions,20%

            Upcoming Conference

            POPL '25

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader