Abstract
We present a new, syntax-directed framework for Curry-style type systems with subtyping. It supports a rich set of features, and allows for a reasonably simple theory and implementation. The system we consider has sum and product types, universal and existential quantifiers, and inductive and coinductive types. The latter two may carry size invariants that can be used to establish the termination of recursive programs. For example, the termination of quicksort can be derived by showing that partitioning a list does not increase its size. The system deals with complex programs involving mixed induction and coinduction, or even mixed polymorphism and (co-)induction. One of the key ideas is to separate the notion of size from recursion. We do not check the termination of programs directly, but rather show that their (circular) typing proofs are well-founded. Termination is then obtained using a standard (semantic) normalisation proof. To demonstrate the practicality of the system, we provide an implementation accepting all the examples discussed in the article.
- Martín Abadi, Luca Cardelli, and Gordon Plotkin. 1993. Types for the Scott Numerals. Retrieved on the 12 September, 2016 from http://lucacardelli.name/papers/notes/scott2.ps.Google Scholar
- Martín Abadi, Georges Gonthier, and Benjamin Werner. 2004. Choice in dynamic linking. In FOSSACS’04 - Foundations of Software Science and Computation Structures 2004, Lecture Notes in Computer Science. Springer, 12--26.Google Scholar
Cross Ref
- Andreas Abel. 1998. Foetus - Termination Checker for Simple Functional Programs. Retrieved on the 7 July, 2017 from http://www2.tcs.ifi.lmu.de/∼abel/foetus.pdf.Google Scholar
- Andreas Abel. 2006. Semi-continuous Sized Types and Termination. Springer, 72--88. Google Scholar
Digital Library
- Andreas Abel and Brigitte Pientka. 2013. Wellfounded recursion with copatterns: A unified approach to termination and productivity. In ICFP Proceedings, Greg Morrisett and Tarmo Uustalu (Eds.). ACM, 185--196. Google Scholar
Digital Library
- Roberto M. Amadio and Luca Cardelli. 1993. Subtyping recursive types. ACM Transactions on Programming Languages and Systems 15 (1993). Google Scholar
Digital Library
- David Baelde, Amina Doumane, and Alexis Saurin. 2015. Least and greatest fixed points in ludics. In CSL (LIPIcs), Vol. 41. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 549--566.Google Scholar
- David Baelde, Amina Doumane, and Alexis Saurin. 2016. Infinitary proof theory: The multiplicative additive case. In CSL (LIPIcs), Vol. 62. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 42:1--42:17.Google Scholar
- John L. Bell. 1993. Hilbert’s ϵ-operator in intuitionistic type theories. Mathematical Logic Quarterly 39, 1 (1993), 323--337.Google Scholar
Cross Ref
- Frédéric Blanqui. 2006. Decidability of type-checking in the calculus of algebraic constructions with size annotations. CoRR abs/cs/0608125.Google Scholar
- Frédéric Blanqui and Cody Roux. 2009. On the relation between sized-types based termination and semantic labelling. In Proceedings of the 23rd International Workshop on Computer Science Logic (CSL 2009) and the 18th Annual Conference of the EACSL. 147--162. Google Scholar
Digital Library
- James Brotherston. 2005. Cyclic proofs for first-order logic with inductive definitions. In Proceedings of TABLEAUX’05, Lecture Notes in Computer Science, Vol. 3702. Springer-Verlag, 78--92. Google Scholar
Digital Library
- Luca Cardelli and Xavier Leroy. 1990. Abstract types and the dot notation. In Proceedings of the IFIP TC2 Working Conference on Programming Concepts and Methods. North-Holland, 479--504.Google Scholar
- L. Cardelli, S. Martini, J. C. Mitchell, and A. Scedrov. 1991. An extension of system F with subtyping. In Proceedings of TACS, T. Ito and A. R. Meyer (Eds.), Lecture Notes in Computer Science, Vol. 526. 750--770. Google Scholar
Digital Library
- Judicaël Courant. 2007. MC<sub>2</sub> A module calculus for pure type systems. Journal of Functional Programming 17, 3 (2007), 287--352.Google Scholar
Cross Ref
- Julien Cretin and Didier Rémy. 2014. System F with coercion constraints. In CSL-LICS Proceedings, Thomas A. Henzinger and Dale Miller (Eds.). ACM. Google Scholar
Digital Library
- Luis Damas and Robin Milner. 1982. Principal type-schemes for functional programs. In Proceedings of the 9th ACM Symposium on Principles of Programming Languages. 207--212. Google Scholar
Digital Library
- Martin Davis and Ronald Fechter. 1991. A free variable version of the first-order predicate calculus. Journal of Logic and Computation 1, 4 (1991), 431--451.Google Scholar
Cross Ref
- Stephen Dolan and Alan Mycroft. 2017. Polymorphism, subtyping, and type inference in MLsub. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages (POPL’17). ACM, 60--72. Google Scholar
Digital Library
- Amina Doumane. 2017. On the infinitary proof theory of logics with fixed points. (Théorie de la démonstration infinitaire pour les logiques à points fixes). Ph.D. Dissertation. Paris Diderot University, France.Google Scholar
- Joshua Dunfield and Neelakantan R. Krishnaswami. 2013. Complete and easy bidirectional typechecking for higher-rank polymorphism. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming (ICFP’13). ACM, New York, 429--442. Google Scholar
Digital Library
- Jérôme Fortier and Luigi Santocanale. 2013. Cuts for circular proofs. In TACL (EPiC Series in Computing), Vol. 25. EasyChair, 72--75.Google Scholar
- Jérôme Fortier and Luigi Santocanale. 2013. Cuts for circular proofs: Semantics and cut-elimination. In CSL (LIPIcs), Vol. 23. Schloss Dagstuhl - Leibniz-Zentrum fuer Informatik, 248--262.Google Scholar
- Jacques Garrigue. 1998. Programming with polymorphic variants. In ML Workshop.Google Scholar
- Jean-Yves Girard. 1972. Interprétation Fonctionnelle et Élimination des Coupures de l’Arithmétique d’Ordre Supérieur. Ph.D. Dissertation. Université Paris 7.Google Scholar
- Jean-Yves Girard, Paul Taylor, and Yves Lafont. 1989. Proofs and Types. Cambridge University Press. Google Scholar
Digital Library
- Benjamin Grégoire and Jorge Luis Sacchini. 2010. On strong normalization of the calculus of constructions with type-based termination. In Proceedings of the 17th International Conference on Logic for Programming, Artificial Intelligence, and Reasoning (LPAR-17). 333--347. Google Scholar
Digital Library
- D. Hilbert and P. Bernays. 1968. Grundlagen der Mathematik. Grundlehren der Mathematischen Wissenschaften, Vol. 1.Google Scholar
- John Hughes, Lars Pareto, and Amr Sabry. 1996. Proving the correctness of reactive systems using sized types. In POPL Proceedings, Hans-Juergen Boehm and Guy L. Steele, Jr. (Eds.). ACM. Google Scholar
Digital Library
- Pierre Hyvernat. 2014. The size-change termination principle for constructor based languages. Logical Methods in Computer Science 10, 1 (2014).Google Scholar
- Frédéric Blanqui (INRIA). 2017. Size-Bases Termination of Higher-Order Rewrite Systems.Google Scholar
- Frédéric Blanqui (INRIA) and Colin Riba (INPL). 2006. Combining Typing and Size Constraints for Checking the Termination of Higher-Order Conditional Rewrite Systems. Springer, 105--119. Google Scholar
Digital Library
- Dexter Kozen and Rohit Parikh. 1983. A decision procedure for the propositional μ-calculus. In Logic of Programs, Lecture Notes in Computer Science, Vol. 164. Springer, 313--325. Google Scholar
Digital Library
- Jean-Louis Krivine. 1987. Un algorithme non typable dans le système F. CRAS 304 (1987).Google Scholar
- Didier Le Botlan and Didier Rémy. 2003. MLF: Raising ML to the power of system F. SIGPLAN Notices 38, 9 (Aug. 2003), 27--38. Google Scholar
Digital Library
- C. S. Lee, N. D. Jones, and A. M. Ben-Amram. 2001. The size-change principle for program termination. In POPL Proceedings. ACM, 81--92. Google Scholar
Digital Library
- Rodolphe Lepigre. 2016. A classical realizability model for a semantical value restriction. In Proceedings of the 25th European Symposium on Programming (ESOP’16), Peter Thiemann (Ed.), Lecture Notes in Computer Science, Vol. 9632. Springer, 476--502.Google Scholar
Digital Library
- Rodolphe Lepigre. 2017. Semantics and Implementation of an Extension of ML for Proving Programs. (Sémantique et Implantation d’une Extension de ML pour la Preuve de Programmes). Ph.D. Dissertation. Université Grenoble Alpes, France.Google Scholar
- R. Lepigre and C. Raffalli. 2015. SubML Implementation. https://github.com/rlepigre/subml/.Google Scholar
- The Coq development team. 2004. The Coq Proof Assistant Reference Manual. LogiCal Project.Google Scholar
- John C. Mitchell. 1988. Polymorphic type inference and containment. Information and Computation 76, 2 (1988), 211--249. Google Scholar
Digital Library
- John C. Mitchell, Sigurd Meldal, and Neel Madhav. 1991. An extension of standard ML modules with subtyping and inheritance. In POPL. ACM, 270--278. Google Scholar
Digital Library
- Ulf Norell. 2009. Dependently typed programming in agda. In Proceedings of the 4th International Workshop on Types in Language Design and Implementation (TLDI’09). Google Scholar
Digital Library
- Miche Parigot. 1992. Un récurseur fortement normalisable et typable pour les entiers de Scott. Private communication.Google Scholar
- Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich, and Mark Shields. 2007. Practical type inference for arbitrary-rank types. Journal of Functional Programming 17, 1 (Jan. 2007), 1--82. Google Scholar
Digital Library
- Benjamin C. Pierce. 2002. Types and Programming Languages. MIT Press. Google Scholar
Digital Library
- François Pottier. 1998. Synthèse de types en présence de sous-typage: de la théorie à la pratique. Ph.D. Dissertation. Université Paris 7.Google Scholar
- C. Raffalli. 1998. Type checking in system F<sup>η</sup>. In Prépublication 98-05a du LAMA.Google Scholar
- C. Raffalli. 2008. The PhoX Proof Assistant. Retrieved on the 12 September, 2016 from https://www.lama.univ-smb.fr/∼raffalli/phox.html.Google Scholar
- C. Raffalli. 2012. The PML Programming Language. Retrieved 12 September, 2016 from https://www.lama.univ-smb.fr/tracpml.Google Scholar
- Didier Rémy. 2005. Simple, partial type-inference for system F based on type-containment. In Proceedings of the 10th ACM SIGPLAN International Conference on Functional Programming (ICFP’05). ACM, New York, 130--143. Google Scholar
Digital Library
- Christian Retoré. 2014. Typed Hilbert epsilon operators and the semantics of determiner phrases. In Formal Grammar, Glyn Morrill, Reinhard Muskens, Rainer Osswald, and Frank Richter (Eds.). Springer, Berlin, 15--33. Google Scholar
Digital Library
- John C. Reynolds. 1974. Towards a theory of type structure. In Programming Symposium, Proceedings Colloque sur la Programmation. Springer-Verlag, 408--423. Google Scholar
Digital Library
- Jorge Luis Sacchini. 2013. Type-based productivity of stream definitions in the calculus of constructions. In Proceedings of the 28th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS’13). 233--242. Google Scholar
Digital Library
- Jorge Luis Sacchini. 2015. Well-Founded Sized Types in the Calculus of (Co)Inductive Constructions. Retrieved on the 12 September, 2016 from http://cs.ioc.ee/types15/abstracts-book/contrib30.pdf.Google Scholar
- Luigi Santocanale. 2002. A calculus of circular proofs and its categorical semantics. In FoSSaCS, Lecture Notes in Computer Science, Vol. 2303. Springer, 357--371. Google Scholar
Digital Library
- Luigi Santocanale. 2002. From parity games to circular proofs. Electronic Notes in Theoretical Computer Science 65, 1 (2002), 305--316.Google Scholar
Cross Ref
- Ulrich Schöpp and Alex Simpson. 2002. Verifying temporal properties using explicit approximants: Completeness for context-free processes. In FOSSACS’02. Springer-Verlag, 372--386. Google Scholar
Digital Library
- Christoph Sprenger and Mads Dam. 2003. On global induction mechanisms in a μ-calculus with explicit approximations. ITA 37, 4 (2003), 365--391. https://dblp.uni-trier.de/rec/bibtex/journals/ita/SprengerD03.Google Scholar
- Christoph Sprenger and Mads Dam. 2003. On the structure of inductive reasoning: Circular and tree-shaped proofs in the μ-calculus. In Proceedings of FOSSACS 2003. Springer, 425--440. Google Scholar
Digital Library
- J. Tiuryn and P. Urzyczyn. 2002. The subtyping problem for second-order types is undecidable. Information and Computation 179, 1 (2002), 1--18. Google Scholar
Digital Library
- Klaus Von Heusinger. 1997. Definite Descriptions and Choice Functions. Springer Netherlands, Dordrecht, 61--91.Google Scholar
- J. B. Wells. 1994. Typability and type-checking in the second-order lambda-calculus are equivalent and undecidable. In LICS Proceedings. IEEE Computer Society, 176--185.Google Scholar
- J. B. Wells. 1996. Typability is Undecidable for F+Eta. Technical Report. Boston, MA. Google Scholar
Digital Library
- J. B. Wells. 1999. Typability and type checking in System F are equivalent and undecidable. Annals of Pure and Applied Logic 98, 1 (1999), 111--156.Google Scholar
Cross Ref
Index Terms
Practical Subtyping for Curry-Style Languages
Recommendations
Coinductive Axiomatization of Recursive Type Equality and Subtyping
We present new sound and complete axiomatizations of type equality and subtype inequality for a first-order type language with regular recursive types. The rules are motivated by coinductive characterizations of type containment and type equality via ...
Polymorphic lambda calculus and subtyping
We present a denotational model for F, the extension of second-order lambda calculus with subtyping defined in Cardelli and Wegner (ACM Comput. Surveys 17(4) (1985) 471-522.) Types are interpreted as arbitrary cpos and elements of types as natural ...
Complete coinductive subtyping for abstract compilation of object-oriented languages
FTFJP '10: Proceedings of the 12th Workshop on Formal Techniques for Java-Like ProgramsCoinductive abstract compilation is a novel technique, which has been recently introduced, for defining precise type systems for object-oriented languages. In this approach, type inference consists in translating the program to be analyzed into a Horn ...






Comments