We establish a general framework for reasoning about the relationship between call-by-value and call-by-name. In languages with side-effects, call-by-value and call-by-name executions of programs often have different, but related, observable behaviours. For example, if a program might diverge but otherwise has no side-effects, then whenever it terminates under call-by-value, it terminates with the same result under call-by-name. We propose a technique for stating and proving these properties. The key ingredient is Levy's call-by-push-value calculus, which we use as a framework for reasoning about evaluation orders. We show that the call-by-value and call-by-name translations of expressions into call-by-push-value have related observable behaviour under certain conditions on side-effects, which we identify. We then use this fact to construct maps between the call-by-value and call-by-name interpretations of types, and identify further properties of side-effects that imply these maps form a Galois connection. These properties hold for some side-effects (such as divergence), but not others (such as mutable state). This gives rise to a general reasoning principle that relates call-by-value and call-by-name. We apply the reasoning principle to example side-effects including divergence and nondeterminism.
翻译:我们为逐个呼叫和逐个呼叫之间的关系建立总体推理框架。 在有副作用的语言中,按逐个呼叫和逐个呼叫执行程序往往有不同但相关的可观察行为。例如,如果一个方案可能不同,但以其他方式没有副作用,那么,当它根据逐个呼叫终止时,它就会以同一结果结束。我们建议一种说明和证明这些属性的技术。关键成分是Levy的逐个呼叫和逐个命名计算法,我们用它作为推理评估命令的框架。我们显示,按逐个呼吁和逐个命名将表达变成逐个呼吁和逐个用户翻译在一定条件下的副作用下,我们确定副作用。我们然后用这个事实在逐个呼叫和逐个呼叫解释类型之间绘制地图,并找出意味着这些地图连接的副作用的进一步特性。这些属性是某些副作用(例如按逐个呼吁和逐个命名法原则)的副作用(例如,从整体推理,而不是从整体推理)。</s>