Logic


Conditional Logic applied to Requirement Statements

An example of a Requirement Statement, particularly a functional requirement statement, may be:

When the Engine_Temperature is greater than 100 degrees Celsius [212 degress Fahrenheit], then the Driver_Display shall indicate High_Engine_Temperature_Alarm.

Borrowing terms from Logic the portion “When the Engine_Temperature is greater than 100 degrees Celsius [212 degress Fahrenheit]” is the Antecedent of the statement and “the Driver_Display shall indicate High_Engine_Temperature_Alarm” is the Consequent. The Antecedent portion must be true in order for the Consequent to be true. Therefore the general form of a (functional) requirement statement is

[Antecedent], then [Consequent].

Antecedents are synonymous to the Pre-Condition, Trigger or Guard of the requirement statement whilst Consequent is synonymous to the Effect, Qualifying or Post-Condition of the requirement statement.

Boolean Operators are common functions that take one or multiple Boolean Operands to produce an output.

  • AND (also represented as ∩, ˄, ∙). If X and Y are logical operands then this function is used as “X AND Y”.
  • OR (also represented as U, ˅, +). Used as “X OR Y”.
  • NOT (also represented as ¬, or a line over the operand). Used as “NOT X”
  • THEN (also represented as →). Used as “X THEN Y”

Not strictly an Operator but parentheses are used to nest Boolean Operators.

There are of course other Boolean Operators derived from those above, such as NAND, NOR, XOR, XNOR, etc. but these operators, used in a textual requirements, often cause more confusion than intended.

Take the below requirement as an example:

When [Device_A is Activated] NAND [Device_B is Activated], then Device C is Activated.

You probably read that and process it as follows:

When [Device_A is De-Activated] OR [Device_B is De-Activated], then Device C is Activated.

So instead of using derived Boolean Operators it is recommend to stick to the basics and avoid additional cognitive effort to understand textual requirements.

Boolean Operators are common functions that take one or multiple Boolean Operands to produce an output.

Conjunction of X and Y

Useful for drawing a logical graph the following symbol is used to represent the Boolean Operator AND.

Boolean AND symbol with 2 inputs

Using a truth table the following table shows the output of the Boolean Operator AND.

XYX AND Y
000
010
100
111
Truth Table of Conjunction of X and Y

Boolean Operator OR performs a disjunction of antecedent operands. This is represented in a Venn diagram as follows:

Disjunction of X and Y

Useful for drawing a logical graph the following symbol is used to represent the Boolean Operator OR.

Boolean OR symbol with 2 inputs

Using a truth table the following table shows the output of the Boolean Operator OR.

XYX OR Y
000
011
101
111
Truth Table of Disjunction of X and Y

Boolean Operator NOT performs a negation of antecedent operands. This is represented in a Venn diagram as follows:

Negation of X

Useful for drawing a logical graph the following symbol is used to represent the Boolean Operator NOT.

Boolean NOT symbol

Using a truth table the following table shows the output of the Boolean Operator NOT.

XNOT X
01
10
Truth Table of Negation of X

Applying the Boolean Operator OR to operands is performing Boolean addition to the Operand values. Boolean addition is similar to arithmetic addition except that the sum doesn’t go past the value of 1.

E.g. if X is TRUE (1), Y is FALSE (0) and Z is TRUE (1) then X OR Y OR Z has value TRUE (1) as (1 + 0 + 1 = 1).

Applying the Boolean Operator AND operands is performing Boolean multiplication to the Operand values. Boolean multiplication is the same as arithmetic multiplication.

E.g. if X is TRUE (1), Y is FALSE (0) and Z is TRUE (1) then X AND Y AND Z has value FALSE (0) as (1 x 0 x 1 = 0).

Below is a table of important Boolean Identities.

AdditativeMultiplicative
X ˅ 1 = 1X ˄ 1 = X
X ˅ 0 = XX ˄ 0 = 0
X ˅ X = XX ˄ X = X
X ˅ ¬X = 1X ˄ ¬X = 0
Boolean Algebraic Identities

Boolean Algebra is commutative which means

  • X ˄ Y = Y ˄ X
  • X ˅ Y = Y ˅ X

Boolean Algebra is associative which means

  • X ˄ (Y ˄ Z) = (X ˄ Y) ˄ Z
  • X ˅ (Y ˅ Z) = (X ˅ Y) ˅ Z

Boolean Algebra is distributive which means

  • X ˄ (Y ˅ Z) = (X ˄ Y) ˅ (X ˄ Z)
  • X ˅ (Y ˄ Z) = (X ˅ Y) ˄ (X ˅ Z)

The last one isn’t intuitive at first so needs some explanation:

  1. X ˅ (Y ˄ Z)
  2. let (X ˄ 1) ˅ (Y ˄ Z)
  3. let 1 = 1 ˅ Y therefore X ˄ (1 ˅ Y) ˅ (Y ˄ Z)
  4. use distributive law to multiple out therefore (X ˄ 1) ˅ (X ˄ Y) ˅ (Y ˄ Z)
  5. let 1 = 1 ˅ Z therefore X ˄ (1 ˅ Z) ˅ (X ˄ Y) ˅ (Y ˄ Z)
  6. (X ˄ X) ˅ (X ˄ Z) ˅ (X ˄ Y) ˅ (Y ˄ Z)
  7. (X ˅ Y) ˄ (X ˅ Z)

De Morgan’s Law has two parts.

  • ¬(X ˄ Y) = ¬X ˅ ¬Y or negation of multiplication of operands is equivalent to sum of negated operands.
  • ¬(X ˅ Y) = (¬X) ˄ (¬Y) or negation of sum of operands is equivalent to multiplication of negated operands

      Leave a Reply

      Your email address will not be published. Required fields are marked *