Affiliation:
1. Northeastern University, USA
2. Indiana University, USA
3. University of Edinburgh, UK
Abstract
The polymorphic blame calculus integrates static typing, including universal types, with dynamic typing. The primary challenge with this integration is preserving parametricity: even dynamically-typed code should satisfy it once it has been cast to a universal type. Ahmed et al. (2011) employ runtime type generation in the polymorphic blame calculus to preserve parametricity, but a proof that it does so has been elusive. Matthews and Ahmed (2008) gave a proof of parametricity for a closely related system that combines ML and Scheme, but later found a flaw in their proof. In this paper we present an improved version of the polymorphic blame calculus and we prove that it satisfies relational parametricity. The proof relies on a step-indexed Kripke logical relation. The step-indexing is required to make the logical relation well-defined in the case for the dynamic type. The possible worlds include the mapping of generated type names to their types and the mapping of type names to relations. We prove the Fundamental Property of this logical relation and that it is sound with respect to contextual equivalence. To demonstrate the utility of parametricity in the polymorphic blame calculus, we derive two free theorems.
Funder
National Science Foundation
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
34 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. A Dependently Typed Language with Dynamic Equality;Proceedings of the 8th ACM SIGPLAN International Workshop on Type-Driven Development;2023-08-30
2. GTP Benchmarks for Gradual Typing Performance;Proceedings of the 2023 ACM Conference on Reproducibility and Replicability;2023-06-27
3. Highly illogical, Kirk: spotting type mismatches in the large despite broken contracts, unsound types, and too many linters;Proceedings of the ACM on Programming Languages;2022-10-31
4. Gradual System F;Journal of the ACM;2022-10-28
5. Two Parametricities Versus Three Universal Types;ACM Transactions on Programming Languages and Systems;2022-09-21