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.
Singular and Plural Functions for Functional Logic Programming
函数逻辑编程(FLP)语言使用非终止和非汇合构造器系统(CS)作为程序,以便定义非严格非确定性函数。对于这类函数的参数传递,通常考虑两种语义选择:调用时选择和运行时选择。虽然前者是现代FLP语言的标准选择,但后者缺乏一些属性--主要是组合性--这阻碍了它在实际FLP系统中的使用。传统上,它已被认为是调用时的选择诱导一个单一的指称语义,而运行时的选择诱导一个复数的语义。我们已经发现,后者的识别是错误的,当涉及到模式匹配,因此,我们提出了两个新的组合复数语义CS的是不同的运行时的选择。我们研究了我们的复数语义的基本属性-组合性,极性,单调性的替代,和构造函数系统的冒泡属性的限制形式-以及它们之间的关系和以前的建议,得出的结论是,这些语义形成了一个层次结构的意义上的集合包含的一组计算值。我们还确定了一类程序,其特征在于所提出的复数语义的行为相同的语法标准,和一个程序转换,可以用来模拟其中之一的长期重写。在实践层面上,我们研究如何使用这些语义的表达能力,以提高程序的声明味。我们还提出了一种语言,结合调用时间的选择和我们的复数语义,我们已经实现了在莫德。由此产生的解释器被用来测试几个显着的例子显示的组合语义的能力。逻辑程序设计理论与实践(Theory and Practice of Logic Programming,TPLP)