Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Week 4 Boolean Algebra

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

4 - Introduction to Boolean Algebra

EE1501 – Digital Logic


Frederic Surre

School of Mathematics, Computer Science and Engineering 2016


In this chapter …

 Boolean algebra:
• Postulates
• Theorems

 Boolean function:
• Definition
• How to represent a Boolean function

 Canonical formulas:
• Minterms
• Maxterms

2016 EE1501 – Digital Logic 2


1. Introduction

A bit of history … on Boolean Algebra

 1854: Georges Boole (1815-1864) published “An Investigation


of the Laws of Thought”. He defined an algebra for symbolically
representing logic problems.

 1938: Claude Shannon (father of Information theory) applied


Boole theory to the design of relay networks in telephone
systems

 After that (1950s)… development of computers and digital


electronics. Boolean algebra is recognised as a major tool to
design systems were variables can only take two values.

2016 EE1501 – Digital Logic 3


1. Introduction

Some basics of Boolean Algebra

 Three basic logical operations:


• AND (represented by a dot or by the absence of an operator),
• OR (represented by a plus sign)
• NOT (represented by a prime or by a bar above the variable). It is called
complement.

 In all this chapter, A, B and C are three logical variables (i.e.


variables that can take only 0 or 1 as value)

 If we draw the comparison with logic, a variable equals 1 when it is


TRUE and 0 when it is FALSE

 Boolean Algebra is built around axioms and theorem that should


be known as they are very useful to simplify Boolean expressions

2016 EE1501 – Digital Logic 4


2. Boolean Algebra

Axioms

 Axiom 1
𝟏=𝟎 𝟎=𝟏

Logic justification: if NOT(true), so it is FALSE!!

 Axiom(s) 2

𝟎. 𝟎 = 𝟎 𝟏+𝟏=𝟏
𝟏. 𝟏 = 𝟏 𝟎+𝟎=𝟎
𝟎. 𝟏 = 𝟏. 𝟎 = 𝟎 𝟎+𝟏=𝟏+𝟎=𝟏

Axioms can usually not be proven but in our case some considerations of logic
make them obvious.

2016 EE1501 – Digital Logic 5


2. Boolean Algebra

Theorems (1)

 Theorem 1: Neutrals
𝐀+𝟎=𝐀 𝐀. 𝟏 = 𝐀
𝐀+𝟏=𝟏 𝐀. 𝟎 = 𝟎

 Theorem 2
𝐀+𝐀=𝟏
Logic justification: We must have (A is true or A is false), as A is either true or
false, the result is always true so 1

𝐀. 𝐀 = 𝟎
Logic justification: We must have (A is true and A is false), as A can not be both at
the same time, the results is false, or 0.

2016 EE1501 – Digital Logic 6


2. Boolean Algebra

Theorems (2)

 Theorem 3: Idempotent
𝐀. 𝐀 = 𝐀 𝐀+𝐀=𝐀
Logic justification: Suppose A is true, so (A or A) is true and the result is true. If A is
false, (A or A) is false and the result is false.

 Theorem 4: Involution

𝐀 =𝐀
Logic justification: If A is true, NOT(NOT(A)) is true!! as NOT(A) is false.

 Theorem 5: Commutation
𝐀+𝐁=𝐁+𝐀 𝐀. 𝐁 = 𝐁. 𝐀
Comment: As in “number” algebra, the “+” (OR) and “.” (AND) operations are
commutative
2016 EE1501 – Digital Logic 7
2. Boolean Algebra

Theorems (3)

 Theorem 6: Associativity
𝐀+ 𝐁+𝐂 = 𝐀+𝑩 +𝐂
𝐀 𝐁𝐂 = 𝐀𝐁 𝐂
Comment: As in “number” algebra, the order has no importance.

ATTENTION: This rule is only valid if all the operations are the same!

 Theorem 7: Covering
𝐀 + 𝐀𝐁 = 𝐀
𝐀. 𝐀 + 𝐁 = 𝐀

𝐀 + 𝐀𝐁 = 𝐀 + 𝐁

2016 EE1501 – Digital Logic 8


2. Boolean Algebra

Theorems (4)

 Theorem 8: Distributivity
𝐀 + 𝐁 . 𝐀 + 𝐂 = 𝐀 + 𝐁𝐂
Comment: This rule is very convenient to simplify Boolean expression.
ATTENTION: This rule is only valid if the same variable appears in both brackets
(for example, in the formula above, it is variable A)

𝐀𝐁 + 𝐀𝐂 = 𝐀 𝐁 + 𝐂

 Theorem 9: Combining
𝐀+𝐁 . 𝐀+𝐁 =𝐀
𝐀𝐁 + 𝐀𝐁 = 𝐀

2016 EE1501 – Digital Logic 9


2. Boolean Algebra

Theorems (5)

 Theorem 10: De Morgan’s theorem

𝐀 + 𝐁 = 𝐀. 𝐁 𝐀. 𝐁 = 𝐀 + 𝐁
Logic justification : AB is equal to 1 when both A and B are true. If either A or/and B
is false, AB is equal to 0. So NOT(AB) is equal to 1 when A or/and B is false. This last
condition corresponds to NOT(A) is true or NOT(B) is true.

Generalisation:

𝐀𝟏 + 𝐀𝟐 + 𝐀𝟑 + ⋯ + 𝐀𝐧 = 𝐀𝟏 . 𝐀𝟐 . 𝐀𝟑 . ⋯ . 𝐀𝐧
𝐀𝟏 . 𝐀𝟐 . 𝐀𝟑 . ⋯ . 𝐀𝐧 = 𝐀𝟏 + 𝐀𝟐 + 𝐀𝟑 + ⋯ + 𝐀𝐧
This theorem is very important and useful. As a consequence it should be studied
very carefully
2016 EE1501 – Digital Logic 10
2. Boolean Algebra

Exercises: Simple manipulations

 Exercises: Simplify the following expressions

𝐚 𝐁 + 𝐁𝐂
𝐛 𝐁 + 𝐁𝐂
𝐜 𝐀+𝐁 . 𝐀+𝐂 . 𝐁+𝐂
𝐝 𝐀𝐁 + 𝐀𝐂 + 𝐁𝐂

 Solutions:

𝐚 𝟏
𝐛 𝟎
𝐜 𝐀+𝐁 . 𝐀+𝐂
𝐝 𝐀𝐁 + 𝐀𝐂

2016 EE1501 – Digital Logic 11


2. Boolean Algebra

Comparisons between number algebra and Boolean algebra

 Along the way, we highlighted similarities between Boolean


algebra and “number” algebra:
• Associative law;
• Factorisation;
• Commutation law;

 But there are also differences:


• Boolean algebra does not have additive or multiplicative inverse
there are no subtraction or division operations;
• Duality principle: each relationship, law or theorem has a dual, obtained
by replacing every occurrence of 1 by 0, 0 by 1, + by · (OR by AND) and ·
by + (AND by OR). This comes from De Morgan’s theorem;
• Different law of distribution (cf slide theorem (4) );

2016 EE1501 – Digital Logic 12


2. Boolean Algebra

Comparisons between binary logic and binary arithmetic

 We can also look at the relation between binary logic and binary
arithmetic.

 Similarity:
• Addition;
• Multiplication;

 Difference:
• An arithmetic variable may consist of many digits; a logic variable is always
either a 1 or a 0
• Binary addition and binary OR are not equivalent:
 In binary arithmetic: 1+1=(1)0 (addition);
 In binary logic: 1+1=1 (OR)

2016 EE1501 – Digital Logic 13


3. Boolean Functions

Boolean functions definition

 Boolean expression: combination of Boolean variables and Boolean


operators, i.e :
• AND
• OR
• NOT
• All other functions/operators can be expressed using AND, OR and NOT

 Boolean function describes how a Boolean variable, called output


and noted C varies as a function of a number of Boolean inputs,
noted A1 to An:
𝐂 = 𝐅 𝐀𝟏, 𝐀𝟐, ⋯ , 𝐀𝐧

 The operator precedence for evaluating Boolean expressions is


(1) Parentheses, (2) NOT, (3) AND, and (4) OR

2016 EE1501 – Digital Logic 14


3. Boolean Functions

How to represent a Boolean function

 Algebraic expression
F(A, B)  A  B

 Truth table
A B C
0 0 1
0 1 0
1 0 1
1 1 1

 Electrical circuit using logic gates


A

B F(A,B)

2016 EE1501 – Digital Logic 15


3. Boolean Functions

Examples

 Example:
(a) Represent the following functions in a truth table:
𝐅𝟏 = 𝐀𝐁𝐂
𝐅𝟐 = 𝐀 + 𝐁𝐂
𝐅𝟑 = 𝐀𝐁𝐂 + 𝐀𝐁𝐂 + 𝐀𝐁
𝐅𝟒 = 𝐀𝐁 + 𝐀𝐂

(b) When possible, simplify the functions above using


algebraic means
(c) Implement these functions with gates

2016 EE1501 – Digital Logic 16


4. Canonical Forms

How to write a Boolean expression: minterms

 Canonical formulas for a function


• From the truth table, the function is written as a Boolean expression. Two
main possibilities: minterms or maxterms canonical formula.

 Minterm: correspond to the product (AND) where all literals (or


variables) appear only once, either true or complemented.
• Examples for 3 variables expression: 𝑨𝑩𝑪, 𝑨𝑩𝑪, …

 Minterm Canonical Form: It is a sum (OR) of minterms. E.g.:


• Also called standard sum-of-products
𝐅 = 𝐀𝐁𝐂 + 𝐀𝐁𝐂

2016 EE1501 – Digital Logic 17


4. Canonical Forms

How to write a Boolean expression: maxterms

 Maxterm: correspond to a sum (OR) where all literals (or


variables) appear only once, either true or complemented.
• Examples for 3 variables expression : 𝑨 + 𝑩 + 𝑪 , 𝑨 + 𝑩 + 𝑪

 Maxterm Canonical Form: It is a product (AND) of maxterms,


e.g.:
𝐅= 𝐀+𝐁+𝐂 . 𝐀+𝐁+𝐂
• Also called standard product-of-sums

 It is the dual of minterm

 It is easy to translate a sum-of-products or a product-of-sums


into a logic gate circuit

2016 EE1501 – Digital Logic 18


4. Canonical Forms

How to derive a canonical form (1)

 First, we need the correspondence tables between the values of


the input and the minterms and maxterms.

For example in the case of a 3 variable function:

A B C Minterms A B C Maxterms
0 0 0 𝐦𝟎 = 𝐀. 𝐁. 𝐂 0 0 0 𝐌𝟎 = 𝐀 + 𝐁 + 𝐂
0 0 1 𝐦𝟏 = 𝐀. 𝐁. 𝐂 0 0 1 𝐌𝟏 = 𝐀 + 𝐁 + 𝐂
0 1 0 𝐦𝟐 = 𝐀. 𝐁. 𝐂 0 1 0 𝐌𝟐 = 𝐀 + 𝐁 + 𝐂
0 1 1 𝐦𝟑 = 𝐀. 𝐁. 𝐂 0 1 1 𝐌𝟑 = 𝐀 + 𝐁 + 𝐂
1 0 0 𝐦𝟒 = 𝐀. 𝐁. 𝐂 1 0 0 𝐌𝟒 = 𝐀 + 𝐁 + 𝐂
1 0 1 𝐦𝟓 = 𝐀. 𝐁. 𝐂 1 0 1 𝐌𝟓 = 𝐀 + 𝐁 + 𝐂
1 1 0 𝐦𝟔 = 𝐀. 𝐁. 𝐂 1 1 0 𝐌𝟔 = 𝐀 + 𝐁 + 𝐂
1 1 1 𝐦𝟕 = 𝐀. 𝐁. 𝐂 1 1 1 𝐌𝟕 = 𝐀 + 𝐁 + 𝐂

2016 EE1501 – Digital Logic 19


4. Canonical Forms

How to derive a canonical form (2): Sum-of-products

 From the truth table of the function, identify each row where the
function has a value of one.

 From the conversion table (previous slide), add (or OR) the
minterm associated to each row. This is the minterm canonical
formula.

 Example 1: let’s consider the truth table from slide 15.


• Three rows where F equals 1: row 0, 2 and 3. So the function can be
expressed as the sum of three minterms: m0, m2 and m3 or 𝐀𝐁, 𝐀𝐁 and 𝐀𝐁
The function is:
𝐅 = 𝐀𝐁 + 𝐀𝐁 + 𝐀𝐁 = 𝐦 𝟎, 𝟐, 𝟑

 Example 2: Find the Boolean expression of the XOR gate using


sum-of product
2016 EE1501 – Digital Logic 20
4. Canonical Forms

How to derive a canonical form (3): Product-of-sums

 From the truth table of the function, identify each row where the
function has a value of zero.

 From the conversion table, multiply (or AND) the maxterm


associated to each identified row. This is the maxterm canonical
formula.

 Simple example: let’s consider the truth table of the XOR gate (see
chapter 3).
• Two rows where F equals 0: row 1 and 4. The function can be expressed as
the product of two maxterms: M1 and M4 or A + B, A + B.
The function is:
𝐅= 𝐀+𝐁 . 𝐀+𝐁 = 𝐌 𝟎, 𝟒

2016 EE1501 – Digital Logic 21


4. Canonical Forms

Canonical forms: Example

 Express the Boolean functions from the given truth table by (a)
a sum of minterms (b) product of maxterms

A B C F1 F2
0 0 0 0 0
0 0 1 1 0
0 1 0 0 1
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1

2016 EE1501 – Digital Logic 22


4. Canonical Forms

Conversion between canonical forms

 Consider the function:


F(A, B, C)   m(1,4,5,6,7)
 This has a complement that can be expressed as
FA, B, C   m0,2,3  m0  m 2  m3

 If we take the complement of 𝐅 by DeMorgan’s theorem, F will


be
F  m0  m2  m3   m0 .m2 .m3  M0M 2M 3   M0,2,3

 From the table, it is clear that the following relation holds true:
mi  M i

 The maxterm with subscript i is a complement of the minterm


with the same subscript i, and vice versa
2016 EE1501 – Digital Logic 23
4. Canonical Forms

Examples

 Express the Boolean function:


𝐅 = 𝐀 + 𝐁𝐂
in a sum of minterms

Solution: 𝐅 = 𝐦 𝟏, 𝟒, 𝟓, 𝟔, 𝟕

 Express the Boolean function


𝐅 = 𝐀𝐁 + 𝐀𝐂
in a product of maxterms

Solution: 𝐅 = 𝐌 𝟎, 𝟐, 𝟒, 𝟓

2016 EE1501 – Digital Logic 24

You might also like