Skip to main content
QUICK REVIEW

[Paper Review] Short-circuit logic

J.A. Bergstra, Alban Ponse|arXiv (Cornell University)|Oct 18, 2010
Logic, programming, and type systemsComputer Science23 references9 citations
TL;DR

This paper introduces a formal framework for short-circuit logic based on Hoare’s conditional connective, establishing a hierarchy of logics that model side effects in evaluation. It presents axiomatizations for Free Short-Circuit Logic (FSCL) and Memorizing Short-Circuit Logic (MSCL), and proves completeness for Static Short-Circuit Logic (SSCL), a variant that captures sequential propositional logic with non-commutative conjunction.

ABSTRACT

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.

Motivation & Objective

  • To formalize short-circuit evaluation as a variant of propositional logic with non-commutative connectives.
  • To distinguish between different short-circuit logics based on their treatment of side effects and evaluation strategies.
  • To provide sound and complete axiomatizations for key variants, including MSCL and SSCL.
  • To establish the completeness of Static Short-Circuit Logic (SSCL) under static valuation congruence.
  • To explore the independence and expressiveness of axioms in the proposed logical systems.

Proposed method

  • The paper uses Hoare’s conditional connective (if-then-else) as a primitive to define propositional connectives in short-circuit logic.
  • It introduces a generic definition of short-circuit logics based on axioms governing the conditional connective and evaluation behavior.
  • Normal forms and tree decompositions are used to analyze and normalize expressions in FSCL and MSCL.
  • The paper defines valuation congruences—memorizing and static—to distinguish between different logical equivalences under side effects.
  • It provides an elegant equational basis for static valuation congruence and proves ω-completeness for SSCL.
  • Independence of axioms is demonstrated via five distinct models, each invalidating one axiom while preserving the others.

Experimental results

Research questions

  • RQ1What logical laws govern short-circuit evaluation when side effects are possible?
  • RQ2How do different evaluation strategies (e.g., free vs. memorizing) lead to distinct logical systems?
  • RQ3Can a complete and sound axiomatization be constructed for static short-circuit logic (SSCL)?
  • RQ4What is the role of non-commutativity in short-circuit conjunction, and how is it captured formally?
  • RQ5How can the independence of axioms in short-circuit logic be formally established?

Key findings

  • FSCL is the most permissive short-circuit logic, allowing full side effects from every atomic evaluation.
  • MSCL is the most identifying logic, restricting side effects and enforcing non-commutativity in sequential conjunction.
  • SSCL, obtained by extending MSCL with one additional axiom, is shown to be ω-complete.
  • The axiomatization of SSCL is both elegant and symmetric, with independent axioms verified via five distinct models.
  • The paper demonstrates that the axioms of SSCL are independent by constructing models that satisfy all but one axiom at a time.
  • The logical framework successfully captures the semantics of imperative short-circuit evaluation, including conditional behavior and side effects, in a formal and equational setting.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.