Graded modal types systems and coeffects are becoming a standard formalism to deal with context-dependent computations where code usage plays a central role. The theory of program equivalence for modal and coeffectful languages, however, is considerably underdeveloped if compared to the denotational and operational semantics of such languages. This raises the question of how much of the theory of ordinary program equivalence can be given in a modal scenario. In this work, we show that coinductive equivalences can be extended to a modal setting, and we do so by generalising Abramsky's applicative bisimilarity to coeffectful behaviours. To achieve this goal, we develop a general theory of ternary program relations based on the novel notion of a comonadic lax extension, on top of which we define a modal extension of Abramsky's applicative bisimilarity (which we dub modal applicative bisimilarity). We prove such a relation to be a congruence, this way obtaining a compositional technique for reasoning about modal and coeffectful behaviours. But this is not the end of the story: we also establish a correspondence between modal program relations and program distances. This correspondence shows that modal applicative bisimilarity and (a properly extended) applicative bisimilarity distance coincide, this way revealing that modal program equivalences and program distances are just two sides of the same coin.
翻译:标准模式类型体系和连效效应正在成为处理基于背景的计算的标准形式主义,而代码使用在这种计算中起着中心作用。但是,与这些语言的分解和操作语义学相比,模式语言和连效语言的程序等同理论的理论相当不发达,但与这些语言的分解和操作语义相比,这种理论相当不发达。这提出了普通程序等同理论在模式情景中可以给予多大程度的参数的问题。在这项工作中,我们证明,同质等值可以延伸到一个模式设置,我们这样做的方法就是将Abramsky的相适应性双相似性与共性行为相适应性。为了实现这一目标,我们发展了一个基于共振松散扩展扩展性新概念的交替性方案关系总体理论。除了这个概念外,我们还定义了Abramsky的相近性相近性相近性等同性理论的模型扩展性(我们把模式相近性相近性相近性相近性相近性相近性) 。我们证明, 这样的一种相似性关系是相同的, 通过这种方式获得解释模型和连效性行为的构成技术。但是,这不是一个类似性的相近性程序的结束:我们也可以的相近性模式和双相近性程序。