arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1010.3674cs.LOmath.LO
收藏

短路逻辑

Short-circuit logic

Jan A. Bergstra, A. Ponse, D. J. C. Staudt

摘要:

短路求值(Short-circuit evaluation)表示命题连接词的语义,其中只有当第一个参数不足以确定表达式的值时,才对第二个参数求值。在编程中,短路求值被广泛使用,顺序合取和析取作为原始连接词。短路逻辑是命题逻辑(PL)的一种变体,可以借助Hoare的条件来定义,这是一种与if-then-else相当的三元连接词,并且暗示了从条件的四个基本公理得出的所有恒等式,并且可以用PL表示(例如,合取和双重否定移位的结合性公理)。在没有副作用的情况下,短路评估表征PL。然而,短路评估允许对副作用进行建模的可能性,并产生各种不同的短路逻辑。第一个极端情况是FSCL(自由短路逻辑),它描述了对每个原子(命题变量)的求值可能产生副作用的设置。另一个极端的情况是MSCL(记忆短路逻辑),这是我们在PL之下区分的最具识别性的变体。在MSCL中,只能对非常有限类型的副作用进行建模,而顺序连接是不可交换的。我们提供了公理化FSCL和MSCL。扩展MSCL与一个简单的公理产生SSCL(静态短路逻辑,或顺序PL),我们也提供了一个完整的结果。我们简要讨论了FSCL和MSCL之间的两个变体,其中一个逻辑承认原子的收缩和它们的否定。

英文摘要:

Short-circuit evaluation denotes the semantics of propositional connectives in which the second argument is evaluated only if the first argument does not suffice to determine the value of the expression. In programming, short-circuit evaluation is widely used, with sequential conjunction and disjunction as primitive connectives. A short-circuit logic is a variant of propositional logic (PL) that can be defined with help of Hoare's conditional, a ternary connective comparable to if-then-else, and that implies all identities that follow from four basic axioms for the conditional and can be expressed in PL (e.g., axioms for associativity of conjunction and double negation shift). In the absence of side effects, short-circuit evaluation characterizes PL. However, short-circuit evaluation admits the possibility to model side effects and gives rise to various different short-circuit logics. The first extreme case is FSCL (free short-circuit logic), which characterizes the setting in which evaluation of each atom (propositional variable) can yield a side effect. The other extreme case is MSCL (memorizing short-circuit logic), the most identifying variant we distinguish below PL. In MSCL, only a very restricted type of side effects can be modelled, while sequential conjunction is non-commutative. We provide axiomatizations for FSCL and MSCL. Extending MSCL with one simple axiom yields SSCL (static short-circuit logic, or sequential PL), for which we also provide a completeness result. We briefly discuss two variants in between FSCL and MSCL, among which a logic that admits contraction of atoms and of their negations.

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

↑