Toggle Main Menu Toggle Search

Open Access padlockePrints

IF Statements as Logical Disjunction

Lookup NU author(s): Dr Christopher Holt



A conditional statement, as typified by If-Then(Else) or Dijkstra's guarded alternative, is used to select a given flow of control (application) from among two or more choices. This is an implementation-oriented equivalent of logical disjunction, where execution (evaluation) corresponds to truth. In Martin-Lofs type theory a disjunction is interpreted as describing different ways to construct an object, be it a proof or a result; but the description always contains branches with a separate expression for determing which branch to choose. It is suggested that selection from among a number of alternatives can be determined purely on the basis of success and failure, in the sense of relations holding (or not) among their arguments. This simplifies the structure of alternative selection, permitting it to be treated as an associative and commutative dyadic operation. Following Dijkstra, a command is deterministic if alternatives are disjoint. An ordered selection is defined as containing an implicit negation of the preceding alternative. This approach provides a natural framework within which to describe an extension of Hoare's communication guards to allow more than one communication, and also to define priorities among alternatives. The role of an explicit guard is clarified as useful for optimizing execution and proofs of correctness.

Publication metadata

Author(s): Holt CM

Publication type: Report

Publication status: Published

Series Title: Computing Laboratory Technical Report Series

Year: 1988

Pages: 24

Print publication date: 01/01/1988

Source Publication Date: January 1988

Report Number: 251

Institution: Computing Laboratory, University of Newcastle upon Tyne

Place Published: Newcastle upon Tyne