Affiliation:
1. Kyoto University
2. Kyoto University, Kyoto, Japan
3. Pomona College, CA, USA
Abstract
Manifest contracts track precise program properties by refining types with predicates—for example, {
x
:Int∣
x
> 0} denotes the positive integers. Contracts and polymorphism make a natural combination: programmers can give strong contracts to abstract types, precisely stating pre- and post conditions while hiding implementation details— for instance, an abstract type of stacks might specify that the pop operation has input type {
x
:α Stack ∣ not (empty
x
)}.
This article studies a polymorphic calculus with manifest contracts and establishes fundamental properties including type soundness and relational parametricity. Indeed, this is not the first work on polymorphic manifest contracts, but existing calculi are not very satisfactory. Gronski et al. developed the S
age
language, which introduces polymorphism through the Type:Type discipline, but they do not study parametricity. Some authors of this article have produced two separate works: Belo et al. [2011] and Greenberg [2013] studied polymorphic manifest contracts and parametricity, but their calculi have metatheoretical problems in the type conversion relations. Indeed, they depend on a few conjectures, which turn out to be false. Our calculus is the first polymorphic manifest calculus with parametricity, depending on no conjectures—it resolves the issues in prior calculi with delayed substitution on casts.
Funder
JSPS Grant-in-Aid for Scientific Research
MEXT of Japan
Publisher
Association for Computing Machinery (ACM)
Cited by
10 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Mechanizing Refinement Types;Proceedings of the ACM on Programming Languages;2024-01-05
2. Focusing on Refinement Typing;ACM Transactions on Programming Languages and Systems;2023-12-20
3. How to safely use extensionality in Liquid Haskell;Proceedings of the 15th ACM SIGPLAN International Haskell Symposium;2022-09-06
4. A dependently typed calculus with polymorphic subtyping;Science of Computer Programming;2021-08
5. Gradual typing: a new perspective;Proceedings of the ACM on Programming Languages;2019-01-02