Coherence of type class resolution

Author:

Bottu Gert-Jan1,Xie Ningning2,Marntirosian Koar1,Schrijvers Tom1

Affiliation:

1. KU Leuven, Belgium

2. University of Hong Kong, China

Abstract

Elaboration-based type class resolution, as found in languages like Haskell, Mercury and PureScript, is generally nondeterministic: there can be multiple ways to satisfy a wanted constraint in terms of global instances and locally given constraints. Coherence is the key property that keeps this sane; it guarantees that, despite the nondeterminism, programs still behave predictably. Even though elaboration-based resolution is generally assumed coherent, as far as we know, there is no formal proof of this property in the presence of sources of nondeterminism, like superclasses and flexible contexts. This paper provides a formal proof to remedy the situation. The proof is non-trivial because the semantics elaborates resolution into a target language where different elaborations can be distinguished by contexts that do not have a source language counterpart. Inspired by the notion of full abstraction, we present a two-step strategy that first elaborates nondeterministically into an intermediate language that preserves contextual equivalence, and then deterministically elaborates from there into the target language. We use an approach based on logical relations to establish contextual equivalence and thus coherence for the first step of elaboration, while the second step’s determinism straightforwardly preserves this coherence property.

Funder

University Research Committee, University of Hong Kong

Fonds Wetenschappelijk Onderzoek

Publisher

Association for Computing Machinery (ACM)

Subject

Safety, Risk, Reliability and Quality,Software

Reference40 articles.

1. Step-Indexed Syntactic Logical Relations for Recursive and Quantified Types

2. Amal Ahmed. 2015. Logical Relations. https://www.cs.uoregon.edu/research/summerschool/summer15/curriculum.html . Amal Ahmed. 2015. Logical Relations. https://www.cs.uoregon.edu/research/summerschool/summer15/curriculum.html .

3. Proofs for free

Cited by 6 articles. 订阅此论文施引文献 订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献

1. A type-directed, dictionary-passing translation of method overloading and structural subtyping in Featherweight Generic Go;Journal of Functional Programming;2023

2. The Principles of the Flix Programming Language;Proceedings of the 2022 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software;2022-11-29

3. Generic go to go: dictionary-passing, monomorphisation, and hybrid;Proceedings of the ACM on Programming Languages;2022-10-31

4. A Dictionary-Passing Translation of Featherweight Go;Programming Languages and Systems;2021

5. Verifying replicated data types with typeclass refinements in Liquid Haskell;Proceedings of the ACM on Programming Languages;2020-11-13

同舟云学术

1.学者识别学者识别

2.学术分析学术分析

3.人才评估人才评估

"同舟云学术"是以全球学者为主线,采集、加工和组织学术论文而形成的新型学术文献查询和分析系统,可以对全球学者进行文献检索和人才价值评估。用户可以通过关注某些学科领域的顶尖人物而持续追踪该领域的学科进展和研究前沿。经过近期的数据扩容,当前同舟云学术共收录了国内外主流学术期刊6万余种,收集的期刊论文及会议论文总量共计约1.5亿篇,并以每天添加12000余篇中外论文的速度递增。我们也可以为用户提供个性化、定制化的学者数据。欢迎来电咨询!咨询电话:010-8811{复制后删除}0370

www.globalauthorid.com

TOP

Copyright © 2019-2024 北京同舟云网络信息技术有限公司
京公网安备11010802033243号  京ICP备18003416号-3