arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2205.06150cs.PL
收藏

组合式编程的直接基础

Direct Foundations for Compositional Programming

Andong Fan, Xuejing Huang, Han Xu, Yaozhu Sun, Bruno C. d. S. Oliveira

AI总结:

本文用类型指导操作语义重构 Fi+,直接为支持递归与非直谓多态的完整演算赋予确定性语义,消除 CP 理论与实践差距。

摘要:

最近提出的 CP 语言采用了组合式编程(Compositional Programming):这是一种新的模块化编程风格,可解决诸如表达式问题(Expression Problem)等具有挑战性的问题。CP 构建在一种名为 Fi+ 的、具有不相交交集类型的多态核心语言之上。Fi+ 的语义采用到目标语言的展开方式,并依赖一种复杂的证明技术来证明该展开的一致性。遗憾的是,这种证明技术在技术上具有挑战性,并且难以扩展到许多常见特性,包括递归或非直谓多态。因此,Fi+ 的原始表述并不支持后两个特性,这造成了理论与实践之间的差距,因为 CP 从根本上依赖于它们。本文提出了一种基于类型指导操作语义(TDOS)的 Fi+ 新表述。TDOS 方法最近被提出,用于为具有不相交交集类型(但不具有多态)的语言建模语义。我们的工作表明,TDOS 方法可以扩展到具有不相交多态的语言,并对完整的 Fi+ 演算进行建模。与通过目标语言间接赋予 Fi+ 语义的展开语义不同,TDOS 方法直接赋予 Fi+ 语义。有了 TDOS,就不再需要一致性证明。相反,我们可以简单地证明语义是确定性的。确定性证明只使用简单的推理技术,例如直接归纳法,并且能够处理递归和非直谓多态等棘手特性。这消除了理论与实践之间的差距,并验证了 CP 最初的正确性证明。我们在 Coq 证明助手当中形式化了 Fi+ 演算的 TDOS 变体及其全部证明。

英文摘要:

The recently proposed CP language adopts Compositional Programming: a new modular programming style that solves challenging problems such as the Expression Problem. CP is implemented on top of a polymorphic core language with disjoint intersection types called Fi+. The semantics of Fi+ employs an elaboration to a target language and relies on a sophisticated proof technique to prove the coherence of the elaboration. Unfortunately, the proof technique is technically challenging and hard to scale to many common features, including recursion or impredicative polymorphism. Thus, the original formulation of Fi+ does not support the two later features, which creates a gap between theory and practice, since CP fundamentally relies on them. This paper presents a new formulation of Fi+ based on a type-directed operational semantics (TDOS). The TDOS approach was recently proposed to model the semantics of languages with disjoint intersection types (but without polymorphism). Our work shows that the TDOS approach can be extended to languages with disjoint polymorphism and model the full Fi+ calculus. Unlike the elaboration semantics, which gives the semantics to Fi+ indirectly via a target language, the TDOS approach gives a semantics to Fi+ directly. With a TDOS, there is no need for a coherence proof. Instead, we can simply prove that the semantics is deterministic. The proof of determinism only uses simple reasoning techniques, such as straightforward induction, and is able to handle problematic features such as recursion and impredicative polymorphism. This removes the gap between theory and practice and validates the original proofs of correctness for CP. We formalized the TDOS variant of the Fi+ calculus and all its proofs in the Coq proof assistant.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑