Hostname: page-component-848d4c4894-p2v8j Total loading time: 0 Render date: 2024-05-06T02:44:07.633Z Has data issue: false hasContentIssue false

Dependent ML An approach to practical programming with dependent types

Published online by Cambridge University Press:  01 March 2007

HONGWEI XI*
Affiliation:
Computer Science Department, Boston University, Boston, MA, USA (e-mail: hwxi@cs.bu.edu)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We present an approach to enriching the type system of ML with a restricted form of dependent types, where type index terms are required to be drawn from a given type index language that is completely separate from run-time programs, leading to the DML() language schema. This enrichment allows for specification and inference of significantly more precise type information, facilitating program error detection and compiler optimization. The primary contribution of the paper lies in our language design, which can effectively support the use of dependent types in practical programming. In particular, this design makes it both natural and straightforward to accommodate dependent types in the presence of effects such as references and exceptions.

Type
Article
Copyright
Copyright © Cambridge University Press 2006

References

Andrews, P. B. (1972) General Models, Descriptions and Choice in Type Theory. Journal of Symbolic Logic, 37, 385394.CrossRefGoogle Scholar
Andrews, P. B. (1986) An Introduction to Mathematical Logic: To Truth through Proof. Orlando, Florida: Academic Press.Google Scholar
Augustsson, L. (1998) Cayenne – a language with dependent types. Pages 239–250 of: Proceedings of the 3rd ACM SIGPLAN International Conference on Functional Programming.CrossRefGoogle Scholar
Barendregt, H. P. (1984) The lambda calculus, its syntax and semantics. Revised edition edn. Studies in Logic and the Foundations of Mathematics, vol. 103. Amsterdam: North-Holland.Google Scholar
Barendregt, H. P. (1992) Lambda Calculi with Types. Pages 117–441 of: Abramsky, S., Gabbay, Dov M., & Maibaum, T.S.E. (eds), Handbook of Logic in Computer Science, vol. II. Oxford: Clarendon Press.Google Scholar
Chen, C. & Xi, H. (2003) Implementing Typeful Program Transformations. Pages 20–28 of: Proceedings of ACM SIGPLAN Workshop on Partial Evaluation and Semantics based Program Manipulation.CrossRefGoogle Scholar
Chen, C. & Xi, H. (2005a) Combining Programming with Theorem Proving. Pages 66–77 of: Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming.CrossRefGoogle Scholar
Chen, C. & Xi, H. (2005b) Meta-Programming through Typeful Code Representation. Journal of Functional Programming, 15 (6), 139.CrossRefGoogle Scholar
Chen, C., Shi, R. & Xi, H. (2005) Implementing Typeful Program Transformations. Fundamenta informaticae, 69(1–2), 103–121.Google Scholar
Cheney, J. & Hinze, R. (2003) Phantom Types. Technical Report CUCIS-TR2003-1901. Cornell University. Available at http://techreports.library.cornell.edu:8081/Dienst/UI/1.0/Display/cul.cis/TR2003-1901.Google Scholar
Church, A. (1940) A formulation of the simple type theory of types. Journal of Symbolic Logic, 5, 5668.CrossRefGoogle Scholar
Constable, R. L. et al. . (1986) Implementing Mathematics with the NuPrl Proof Development System. Englewood Cliffs, New Jersey: Prentice-Hall.Google Scholar
Dantzig, G. B. & Eaves, B. C. (1973) Fourier-Motzkin elimination and its dual. Journal of Combinatorial Theory (A), 14, 288297.CrossRefGoogle Scholar
Danvy, O. (1998) Functional unparsing. Journal of Functional Programming, 8 (6), 621625.CrossRefGoogle Scholar
Dowek, G., Felty, A., Herbelin, H., Huet, G., Murthy, C., Parent, C., Paulin-Mohring, C. & Werner, B. (1993) The Coq proof assistant user's guide. Rapport Technique 154. INRIA, Rocquencourt, France. Version 5.8.Google Scholar
Dunfield, J. (2002) Combining two forms of type refinement. Tech. rept. CMU-CS-02-182. Carnegie Mellon University.Google Scholar
Dunfield, J. & Pfenning, F. (2003) Type assignment for intersections and unions in call-by-value languages. Pages 250–266 of: Gordon, A. D. (ed), Proceedings of the 6th International Conference on Foundations of Software Science and Computation Structures (FOSSACS'03). Warsaw, Poland: Springer-Verlag LNCS 2620.Google Scholar
Dunfield, J. & Pfenning, F. (2004) Tridirectional typechecking. Pages 281–292 of: Leroy, X. (ed), Conference Record of the 31st Annual Symposium on Principles of Programming Languages (POPL'04). Venice, Italy: ACM Press. Extended version available as Technical Report CMU-CS-04-117, March 2004.CrossRefGoogle Scholar
Freeman, T. & Pfenning, F. (1991) Refinement types for ML. Pages 268–277 of: ACM SIGPLAN Conference on Programming Language Design and Implementation.CrossRefGoogle Scholar
Girard, J.-Y. (1972) Interprétation fonctionnelle et Élimination des coupures dans l'arith-métique d'ordre supérieur. Thèse de doctorat d'état, Université de Paris VII, Paris, France.Google Scholar
Griffin, T. (1990) A Formulae-as-Types Notion of Control. Pages 47–58 of: Conference Record of POPL '90: 17th ACM SIGPLAN Symposium on Principles of Programming Languages.CrossRefGoogle Scholar
Harper, R. (1994) A simplified account of polymorphic references. Information Processing Letters, 51, 201206.CrossRefGoogle Scholar
Hayashi, S. & Nakano, H. (1988) PX: A computational logic. The MIT Press.Google Scholar
Henkin, L. (1950) Completeness in the theory of types. Journal of Symbolic Logic, 15, 8191.CrossRefGoogle Scholar
Hinze, R. (2001) Manufacturing Datatypes. Journal of Functional Programming, 11 (5), 493524.CrossRefGoogle Scholar
Hughes, J., Pareto, L. & Sabry, A. (1996) Proving the Correctness of Reactive Systems Using Sized Types. Pages 410–423 of: Proceeding of 23rd Annual ACM SIGPLAN Symposium on Principles of Programming Languages (POPL '96).CrossRefGoogle Scholar
INRIA. Objective Caml. http://caml.inria.fr.Google Scholar
Jay, C. B. & Sekanina, M. (1996) Shape checking of array programs. Tech. rept. 96.09. University of Technology, Sydney, Australia.Google Scholar
Jones, S. P., Vytiniotis, D., Weirich, S. & Washburn, G. (2005) Simple Unification-based Type Inference for GADTS.Google Scholar
Kahrs, S. (2001) Red-black trees with types. Journal of Functional Programming, 11 (4), 425432.CrossRefGoogle Scholar
Kreitz, C., Hayden, M. & Hickey, J. (1998) A proof environment for the development of group communication systems. Pages 317–332 of: Kirchner, H. & Kirchner, C. (eds), 15th International Conference on Automated Deduction. LNAI 1421. Lindau, Germany: Springer-Verlag.Google Scholar
Martin-Löf, P. (1984) Intuitionistic type theory. Naples, Italy: Bibliopolis.Google Scholar
Martin-Löf, P. (1985) Constructive mathematics and computer programming. Hoare, C. R. A. (ed), Mathematical logic and programming languages. Prentice-Hall.Google Scholar
McBride, C.Epigram. Available at: http://www.dur.ac.uk/CARG/epigram.Google Scholar
Meyer, A. & Wand, M. (1985) Continuation Semantics in Typed Lambda Calculi (summary). Pages 219–224 of: Parikh, R. (ed), Logics of Programs. Springer-Verlag LNCS 224.Google Scholar
Michaylov, S. (1992) Design and implementation of practical constraint logic programming systems. Ph.D. thesis, Carnegie Mellon University. Available as Technical Report CMU-CS-92-168.Google Scholar
Milner, R., Tofte, M., Harper, R. W. & MacQueen, D. (1997) The Definition of Standard ML (revised). Cambridge, Massachusetts: MIT Press.CrossRefGoogle Scholar
Mitchell, J. C. & Plotkin, G. D. (1988) Abstract types have existential type. ACM Transactions on Programming Languages and Systems, 10 (3), 470502.CrossRefGoogle Scholar
Mitchell, J. C. & Scott, P. J. (1989) Typed lambda models and cartesian closed categories (preliminary version). Pages 301–316 of: Gray, J. W. & Scedrov, A. (eds), Categories in Computer Science and Logic. Contemporary Mathematics, vol. 92. Boulder, Colorado: American Mathematical Society.Google Scholar
Odersky, M., Zenger, C. & Zenger, M. (2001) Colored Local Type Inference. Pages 41–53 of: Proceedings of the 28th Annual ACM SIGPPLAN-SIGACT Symposium on Principles of Programming Languages.Google Scholar
Okasaki, C. (1998) Purely Functional Data Structures. Cambridge University Press.CrossRefGoogle Scholar
Owre, S., Rajan, S., Rushby, J. M., Shankar, N. & Srivas, M. K. (1996) PVS: Combining specification, proof checking, and model checking. Pages 411–414 of: Alur, R. & Henzinger, T. A. (eds), Proceedings of the 8th International Conference on Computer-Aided Verification (CAV'96). New Brunswick, NJ: Springer-Verlag LNCS 1102.Google Scholar
Parent, C. (1995) Synthesizing proofs from programs in the calculus of inductive constructions. Pages 351–379 of: Proceedings of the International Conference on Mathematics for Programs Constructions. Springer-Verlag LNCS 947.CrossRefGoogle Scholar
PeytonJones, S. Jones, S. et al. . (1999) Haskell 98 – A non-strict, purely functional language. Available at http://www.haskell.org/onlinereport/.Google Scholar
Pfenning, F.Computation and Deduction. Cambridge University Press. (To appear).Google Scholar
Pfenning, F. & Elliott, C. (1988) Higher-order abstract syntax. Pages 199–208 of: Proceedings of the ACM SIGPLAN '88 Symposium on Language Design and Implementation.CrossRefGoogle Scholar
Pierce, B. & Turner, D. (1998) Local type inference. Pages 252–265 of: Proceedings of 25th Annual ACM SIGPLAN Symposium on Principles of Programming Languages (POPL '98).CrossRefGoogle Scholar
Pottier, F. & Régis-Gianas, Y. (2006) Stratified type inference for generalized algebraic data types. Pages 232–244 of: Proceedings of the 33rd ACM Symposium on Principles of Programming Languages (POPL'06).CrossRefGoogle Scholar
Pugh, W. & Wonnacott, D. (1992) Eliminating false data dependences using the Omega test. Pages 140–151 of: ACM SIGPLAN '92 Conference on Programming Language Design and Implementation. ACM Press.Google Scholar
Pugh, W. & Wonnacott, D. (1994) Experience with constraint-based array dependence analysis. Tech. rept. CS-TR-3371. University of Maryland.CrossRefGoogle Scholar
Sannella, D. & Tarlecki, A. (1989) Toward formal development of ML programs: Foundations and methodology. Tech. rept. ECS-LFCS-89-71. Laboratory for Foundations of Computer Science, Department of Computer Science, University of Edinburgh.Google Scholar
Sheard, T. (2004) Languages of the future. Proceedings of the Onward! Track of Objected-oriented Programming Systems, Languages, Applications (OOPSLA). Vancouver, BC: ACM Press.CrossRefGoogle Scholar
Shostak, R. E. (1977) On the SUP-INF method for proving Presburger formulas. Journal of the ACM, 24 (4), 529543.CrossRefGoogle Scholar
Sulzmann, M., Odersky, M. & Wehr, M. (1997) Type inference with constrained types. Proceedings of 4th International Workshop on Foundations of Object-oriented Languages.Google Scholar
Takahashi, M. (1995) Parallel Reduction. Information & Computation, 118, 120127.CrossRefGoogle Scholar
Westbrook, E., Stump, A. & Wehrman, I. (2005) A Language-Based Approach to Functionally Correct Imperative Programming. Pages 268–279 of: Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming.CrossRefGoogle Scholar
Wright, A. (1995) Simple imperative polymorphism. Journal of Lisp and Symbolic Computation, 8 (4), 343355.CrossRefGoogle Scholar
Xi, H. (1998) Dependent types in practical programming. Ph.D. thesis, Carnegie Mellon University. pp. viii+189. Available at http://www.cs.cmu.edu/hwxi/DML/thesis.ps.Google Scholar
Xi, H. (1999) Dependently Typed Data Structures. Pages 17–33 of: Proceedings of Workshop on Algorithmic Aspects of Advanced Programming Languages.Google Scholar
Xi, Hongwei. (2003). Dependently Typed Pattern Matching. Journal of Universal Computer Science, 9 (8), 851872.Google Scholar
Xi, H. (2004) Applied Type System (extended abstract). Pages 394–408 of: Post-Workshop Proceedings of Types 2003. Springer-Verlag LNCS 3085.Google Scholar
Xi, H. (2005) Applied Type System. Available at: http://www.cs.bu.edu/hwxi/ATS.Google Scholar
Xi, H. & Pfenning, F. (1998) Eliminating array bound checking through dependent types. Pages 249–257 of: Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation.CrossRefGoogle Scholar
Xi, H. & Pfenning, F. (1999) Dependent Types in Practical Programming. Pages 214–227 of: Proceedings of 26th ACM SIGPLAN Symposium on Principles of Programming Languages. San Antonio, Texas: ACM press.Google Scholar
Xi, H., Chen, C. & Chen, G. (2003) Guarded Recursive Datatype Constructors. Pages 224–235 of: Proceedings of the 30th ACM SIGPLAN Symposium on Principles of Programming Languages. New Orleans, LA: ACM press.Google Scholar
Zenger, C. (1997) Indexed types. Theoretical Computer Science, 187, 147165.CrossRefGoogle Scholar
Zenger, C. (1998) Indizierte typen. Ph.D. thesis, Fakultät für Informatik, Universität Karlsruhe.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.