paperbot · PL 论文追踪

全部论文 待读 收藏

P2 COCHIS: Stable and coherent implicits

COCHIS:稳定且连贯的隐式机制
JFP vol.292019匹配度 2/10 · 该论文属于纯 PL 类型系统与隐式解析理论研究,关注 coherence、类型替换稳定性和 focusing 等证明搜索技术,未涉及 LLM/Agent、静态分析工具、浮点程序分析或贝叶斯程序分析,与画像的核心交叉方向距离较远。仅在类型导向解析和形式化验证基础理论层面有间接关联。引用 10 inbox
TOM SCHRIJVERS, BRUNO C.D.S. OLIVEIRA, PHILIP WADLER, KOAR MARNTIROSIAN
crossref: 2026-09-10

AI 速览

一句话:提出 COCHIS 演算,在保持类型安全、连贯性与类型替换稳定性的同时支持多态、局部作用域、重叠实例与高阶规则。

隐式编程(IP)机制通过类型导向的解析来推断值,使程序更紧凑易读,Haskell 类型类、Scala implicits、Agda 实例参数等均属此类。其设计长期存在争论:一方强调强推理性质,另一方强调局部作用域与重叠实例带来的灵活性与表达力,二者似乎难以兼得。本文提出 COCHIS(Calculus Of CoHerent ImplicitS),是隐式演算的改进变体,在保持连贯性(coherence)与类型替换稳定性这两个关键性质的同时,支持多态、局部作用域、重叠实例、一等实例与高阶规则,并保持类型安全。作者给出隐式解析的两种逻辑表述:第一种简单但存在歧义且不连贯;第二种虽不简单,却无歧义、连贯且在类型替换下稳定。第二种表述的每个解析都是第一种的解析,反之不成立。第二种表述的部分内容与证明搜索中的 focusing 技术高度相似,而实现连贯性的关键在于严格强制确定性。

问题
隐式编程机制的设计在强推理性质(如连贯性、类型替换下的稳定性)与局部作用域、重叠实例等带来的灵活性之间存在张力,现有工作似乎表明二者难以兼得。
方法
提出 COCHIS 演算,给出两种隐式解析的逻辑表述:一种简单但有歧义且不连贯,另一种较复杂但无歧义、连贯且稳定,并通过严格强制确定性来保证连贯性,其部分结构与证明搜索的 focusing 技术相近。
评估
通过形式化演算的元理论性质(类型安全、连贯性、类型替换下的稳定性)以及两种解析表述之间的关系(第二种解析蕴含于第一种但不反之)来评估该设计。
原文摘要(Abstract)

Abstract Implicit programming (IP) mechanisms infer values by type-directed resolution, making programs more compact and easier to read. Examples of IP mechanisms include Haskell’s type classes, Scala’s implicits, Agda’s instance arguments, Coq’s type classes and Rust’s traits. The design of IP mechanisms has led to heated debate: proponents of one school argue for the desirability of strong reasoning properties, while proponents of another school argue for the power and flexibility of local scoping or overlapping instances. The current state of affairs seems to indicate that the two goals are at odds with one another and cannot easily be reconciled. This paper presents COCHIS, the Calculus Of CoHerent ImplicitS, an improved variant of the implicit calculus that offers flexibility while preserving two key properties: coherence and stability of type substitutions . COCHIS supports polymorphism, local scoping, overlapping instances, first-class instances and higher-order rules, while remaining type-safe, coherent and stable under type substitution. We introduce a logical formulation of how to resolve implicits, which is simple but ambiguous and incoherent, and a second formulation, which is less simple but unambiguous, coherent and stable. Every resolution of the second formulation is also a resolution of the first, but not conversely. Parts of the second formulation bear a close resemblance to a standard technique for proof search called focusing. Moreover, key for its coherence is a rigorous enforcement of determinism.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot721,
  title = {COCHIS: Stable and coherent implicits},
  author = {TOM SCHRIJVERS and BRUNO C.D.S. OLIVEIRA and PHILIP WADLER and KOAR MARNTIROSIAN},
  journal = {Journal of Functional Programming},
  volume = {29},
  year = {2019},
  doi = {10.1017/s0956796818000242}
}