Lecture Notes on Boolean Algebra (Part 1 of 3)

1. Review of Propositional Logic in ICS141

Refresh your memory about Propositional Logic.

In addition to propositional logic, it would be good to have basic knowledge of Abstract Algebra.

2. Boolean Algebra

Propositional logic discussed in ICS141 can be reinterpreted from a viewpoint of algebra as Boolean algebra that is an algebraic system on the set B = {0,1}. A logical statement (called a proposition) in propositional logic is regarded as an expression in Boolean algebra. Applications of inference rules to derive a theorem in logic are similar to transformations and/or manipulations of expressions in algebra. Thus, in Boolean algebra, we can manipulate logical statements as algebraic expressions systematically.

Many technical terms in propositional logic are also used in Boolean algebra though, there are some technical terms specific to Boolean algebra.

Propositional Logic Boolean Algebra
propositional variable Boolean variable
proposition Boolean expression
negation complement
logical equivalence equality
etc.

Logical Connectives vs Boolean Operators

Propositional Logic Boolean Algebra
Logical Connective Notation Boolean Operator Notation
negation ¬ complement
conjunction AND
disjunction OR +

Analogy between Boolean Algebra and Arithmetics

Boolean Algebra Arithmetics
Domain truth values numbers (e.g., integers and real numbers)
Operands truth values and/or Boolean variables numbers and/or variables
Unary Operator NOT (complement) − (negative sign)
Binary Operators AND (conjunction), OR (disjunction) + (addition), − (subtraction), × (multiplication), / (division)

Review 2.1 on Boolean Operators:

  1. Give a definition of the Boolean operator called Exclusive OR (denoted by XOR or ⊕) such as x ⊕ y.
    Hint: Construct the truth table of x ⊕ y.

  2. Give a definition of the Boolean operator called NAND (denoted by a vertical bar | which is also called the Sheffer stroke) such as x | y.

  3. Give a definition of the Boolean operator called NOR (denoted by ↓) such as x ↓ y.

Boolean Expressions

A proposition with n propositional variables in propositional logic is regarded as an expression (called a Boolean expression) in Boolean algebra.

Notations for Boolean Expressions

  0 denotes F (false).
  1 denotes T (true).
  p ⋅ q denotes p AND q (i.e., p ∧ q in propositional logic).
     [Note that a dot "⋅" is often omitted.]
  p + q denotes p OR q (i.e., p ∨ q in propositional logic).
  _
  p denotes NOT p (i.e., ¬ p in propositional logic).
     [This operator is called a "complement".]

Some textbooks (especially, in the field of Electrical Engineering) denote the complement of p by p’ (read as “p prime”).

By the traditional convention, it is assumed that an AND operator has a higher precedence than an OR operator if there are no parentheses for explicitly clarifying the order of the operators. For example, x + y ⋅ z is interpreted as x + (y ⋅ z) rather than (x + y) ⋅ z and x y z + a b c is interpreted as (x ⋅ y ⋅ z) + (a ⋅ b ⋅ c).

Review 2.2 on Boolean Expressions: Express the following propositions in Boolean algebra.

  1. ¬ (p ∨ q) ∧ ¬ (¬ r ∨ (p ∧ ¬ q))            Hint?
  2. (p ∧ ¬ q) → r            Hint?
  3. p ∧ q ⇔ ¬ (¬ p ∨ ¬ q)            Hint?

Boolean Functions

A Boolean expression with n Boolean variables represents a function f : {0,1}n → {0,1} that is called an n-ary Boolean function (or n-place Boolean function). The integer n is called the arity (or degree) of the Boolean function. Note that there may be more than one Boolean expression representing the same Boolean function. Two Boolean expressions are said to be equivalent if their truth values are identical for every possible truth assignment to Boolean variables of the Boolean expressions. Since each Boolean function is uniquely defined by a truth table, it is common to use a truth table as the specification of a Boolean function. Thus, two Boolean expressions are equivalent iff their truth tables are identical.

Review 2.3 on Boolean Functions:

  1. How many distinct n-ary Boolean functions are there?            Hint?
  2. Construct a truth table of the following 4-ary Boolean function.
           _ _         ____
      (w + x)y + x(y + (wz))
    
  3. Determine whether the following Boolean expressions equivalent.            Hint?
          _
      x + z
            _    _          _   _ _
      y(x + z) + y x + (x + x ) y z
    

Each equivalence or tautology in propositional logic corresponds to an identity or law in Boolean algebra. Important identities and laws are summarized in Algebraic Laws in Boolean Algebra regarding axioms and useful theorems in Boolean algebra.

Review 2.4 on Transformation of Boolean Expressions by Identities and Laws:

  1. Prove the equality x + y(x + z) = (x + y)(x + z) by showing literally step by step which identity or law is applied for transforming a Boolean expression.

  2. Prove the following equality by showing literally step by step which identity or law is applied for transforming a Boolean expression.
            _    _          _   _ _       _
      y(x + z) + y x + (x + x ) y z = x + z
    

  3. Prove the following equality by showing literally step by step which identity or law is applied for transforming a Boolean expression.
        _ _        _ _ _   _ _       _ _     _         _
    x + y(x + z) = x y z + x y z + x y z + x y z + x y z + x y z
    

Duality

In the list of identities and laws (Algebraic Laws in Boolean Algebra) in Boolean algebra, they are paired so that every identity or law has its counterpart.

The dual of a Boolean expression is a Boolean expression constructed by interchanging all between AND and OR operators and between Boolean constants 0 and 1.

Example 2.5

By using the duality principle of Boolean algebra, an identity or law can logically be derived from another identity or law.

Review 2.5 on the Duality of Boolean Expressions:

  1. Show how you construct the dual of the Boolean expression x(x + y).

  2. Show how you construct the dual of the following Boolean expression.
              _ _ _
      x y z + x y z
    

  3. Show how you construct the dual of the following Boolean expression.
        _   _
      x z + x ⋅ 1 + x ⋅ 0
    

3. Normal Forms

Terminology

Theorem 3.1: For every Boolean function f, there are disjunctive and conjunctive normal forms of f.

Construction of a Sum-of-Products Expansion

  Step 1:  Construct a truth table of a Boolean function f.
  Step 2:  For each combination of truth values of variables for which f is equal to 1,
           create a minterm so that the value 1 of a variable x corresponds to a literal x
                                                       _
           and the value 0 of x corresponds to literal x.
  Step 3:  Construct disjunction of all the minterms obtained at Step 2.

                           _______
                             _
  Example 3.7:  f(x,y,z) = ( x y ) (x + z)

	---------------------------------------------------------------
                                        _____
                                _        _
	x	y	z	x y	(x y)	x+z	f	minterm
	---------------------------------------------------------------
	0	0	0	0	1	0	0
								_ _
	0	0	1	0	1	1	1	x y z
	0	1	0	1	0	0	0
	0	1	1	1	0	1	0
								  _ _
	1	0	0	0	1	1	1	x y z
								  _
	1	0	1	0	1	1	1	x y z
								    _
	1	1	0	0	1	1	1	x y z
	1	1	1	0	1	1	1	x y z
	---------------------------------------------------------------
                 _ _       _ _     _         _
     f(x,y,z) =  x y z + x y z + x y z + x y z + x y z

Construction of a Product-of-Sums Expansion
This is dual to the above process for constructing a sum-of-products expansion.

  Step 1:  Construct a truth table of a Boolean function f.
  Step 2:  For each combination of truth values of variables for which f is equal to 0,
           create a maxterm so that the value 0 of a variable x corresponds to a literal x
                                                       _
           and the value 1 of x corresponds to literal x.
  Step 3:  Construct conjunction of all the maxterms obtained at Step 2.

The Boolean function in the above example is expressed as follows.

                                _             _   _
f(x,y,z) =  ( x + y + z ) ( x + y + z ) ( x + y + z )

Remark 3.1: Some textbooks (especially in the field of electrical engineering) use the following notation for specifying the sum-of-product expansion of a Boolean function,

f(x,y,z) = Σm(1,4,5,6,7)

where “Σm” indicates the sum of minterms and each nonnegative integer in a list denotes the binary representation of a row corresponding to a minterm. Similarly, the following specifies a Boolean function with minterms whose values are “don’t care”.

f(x,y,z) = Σm(1,4,5,7) + Σd(0,6)

4. Exercises

  1. Prove or disprove the following equality by Boolean algebra.
                  _     _       _ _   _       _ _     _ _ _       _
      x y z + x y z + x y z + x y z + x y z + x y z + x y z = x + y + z
    
  2. Construct a truth table for the even parity bit e of three bits x1, x2 and x3 and then derive a sum-of-products expansion of e, where the even parity bit e always makes the number of 1's in the 4 bits x1, x2, x3 and e to be even.

  3. For the Boolean expression x + y + z, show how to derive an equivalent Boolean expression whose Boolean operators are only AND (⋅) and complement.

  4. Prove the following equality in Boolean algebra. Note that your proof must indecate which axiom, identity, equivalence or law is applied to each step in a transformation from the left-hand side to the right-hand side or vice versa.
    x + (y ⋅ (x + z)) = (x + y) ⋅ (x + z)

  5. Show how to convert x + y into its equivalent expression including only the NAND operator | in Boolean algebra.

  6. By using only identities and laws of Boolean algebra in the lecture notes (you cannot use a truth table), prove x + (y(x + z)) = (x + y)(x + z). You must show the equivalence by presenting a step-by-step sequence of applications of the identities to Boolean expressions.

  7. Show how you derive the sum-of-products expansion of the following Boolean function.
                   _   _     _      _       _       _     _
    f(x,y,z) = x ( y + y z + x ) + (x y + y z ) ( x y z + x z )
    

  8. Prove or disprove the following equality.
            _     _           _   _ _       _
    y ( x + z ) + y x + ( x + x ) y ̄z = x + z 
    

  9. Show how you construct an equivalent Boolean expression to the following in the disjunctive normal form.
        _   _
    x + y ( x + z )
    

  10. Suppose a threshold Boolean function f(x1,x2,x3) = 1 iff the unsigned binary integer x1 x2 x3 is at least 4 in decimal. Show how you derive the Boolean expression of f in the disjunctive normal form.

  11. Show how you derive a Boolean expression using only AND and NOT operators that is equivalent to the following Boolean function.
        _   _
    x + y ( x + z )
    
    Hint: Apply DeMorgan's laws.

  12. Show how you derive the sum-of-products expansion of the following Boolean function.
                          _   _
    f(x,y,z) = ( x + y )( x + y + z )
    

More Exercises