Ingineering School of Computer Sciences and Digital Technologies
Option : Cloud Computing
Chapter 1 (part 2)
Presented by:
Dr [Link]
1
Boolean algebra
Introduction
The Boolean algebra is very useful for the construction of logic
circuits, which are the very foundation of current computing
machines.
2
Boolean algebra
1. Some definitions
Combinatorial logic : the output value of a logic system depends
only on the input values and does not depend on the previous states
of the logic system (no memorization).
Logic gate : a basic logic element (electronic circuit) that can have
one or more inputs and a single output, allowing the execution of a
logical operation.
Logical variable : is represented by a symbol that can take two
distinct logical values (0 or 1).
3
Boolean algebra
1. Some definitions
Truth table : the truth table of a logical function F with n Boolean
variables is a table of m columns and k rows such that :
m=n+1 : each column is associated with a variable and the last
column is reserved for the function value.
k=𝟐𝒏 : each row represents a combination of n variables.
4
Boolean algebra
Basic operators
a. Negation (logical NOT)
Unary operator that inverts the value of a variable.
Example: 𝐴ҧ
Truth table : Symbol:
E S
0 1
1 0
5
Boolean algebra
Basic operators
b. Disjunction (logical OR)
Binary operator that makes the logical sum between two logical
variables. It gives 1 if at least one of the input variables is in state 1.
Example: A+B
Truth table : Symbol:
A B S
0 0 0
0 1 1
1 0 1
1 1 1
6
Boolean algebra
Basic operators
c. Conjunction (logical AND)
Binary operator that makes the logical multiplication between two
logical variables. It returns 1 if both input variables are in state 1.
Example: A.B
Truth table : Symbol:
A B S
0 0 0
0 1 0
1 0 0
1 1 1
7
Boolean algebra
Compound operators
d. NOR operator
Binary operator that negates the logical OR operator.
Example: 𝐴 + 𝐵 ≡ A ↓ B
Truth table: Symbol:
A B S
0 0 1
0 1 0
1 0 0
1 1 0
8
Boolean algebra
Compound operators
e. NAND operator
Binary operator that negates the logical AND operator.
Example : 𝐴. 𝐵 = A ↑ B
Truth table: Symbol:
A B S
0 0 1
0 1 1
1 0 1
1 1 0
9
Boolean algebra
Compound operators
f. XOR operator (OR exclusive)
Binary operator that checks if the two input variables are different.
Example: 𝐴 ⊕ 𝐵
Truth table: Symbol:
A B S
0 0 0
0 1 1
1 0 1
1 1 0
10
Boolean algebra
Compound operators
g. XNOR operator
Binary operator that checks if the two input variables are the same.
Example : 𝐴 ⊕ 𝐵
Truth table : Symbol:
A B S
0 0 1
0 1 0
1 0 0
1 1 1
11
Boolean algebra
2. Logical operations and their properties
Logical sum
Logical multiplication
Axioms (+) (.)
Commutativity A+B=B+A A.B=B.A
Associativity A+(B+C)=(A+B)+C A.(B.C)=(A.B).C
Distributivity A+(B.C)=(A+B). (A+C) A.(B+C)=(A.B)+(A.C)
Neutral element A+0=A A.1=A
Complementarity A+𝐴ҧ = 1 A.𝐴ҧ = 0
12
Boolean algebra
2. Logical operations and their properties
Property (+) (.)
Idempotence A+A=A A.A=A
Fundamental theorems (+) (.)
Inhibition ҧ
A+(𝐴.B)=A+B A.(𝐴ҧ +B)=A.B
Absorption A+1=1 A.0=0
A+(A.B)=A A.(A+B)=A
De Morgan’s laws 𝐴 + 𝐵 = 𝐴ҧ . 𝐵ത 𝐴. 𝐵 = 𝐴ҧ + 𝐵ത
Involution 𝐴ҧ = 𝐴
ҧ
𝐴ҧ =𝐴ҧ
13
Boolean algebra
2. Logical operations
Duality theorem
Every property P corresponds a property P*, called dual.
The dual property P* of a property P is obtained by reversing the operators and
swapping the neutral elements.
Example :
Property P Dual property P*
A+A.B=A A.(A+B)=A
A+0=A A.1=A
14
Boolean algebra
3. Logic functions
Representation of Boolean functions
Algebraic form
Truth table
15
Boolean algebra
3. Logic functions
Representation of Boolean functions
Algebraic form
We can represent a Boolean function using the logical operations already seen.
Example :
𝑓(𝑥, 𝑦)= 𝑥.y+
ҧ x. 𝑦ത + 𝑥. 𝑦
𝑥.y,
ҧ x. 𝑦ത and x. 𝑦 are called Algebraic terms
16
Boolean algebra
3. Logic functions
Representation of Boolean functions
A. Transition from algebraic form to truth table
Example: f(x,y) = 𝑥.ҧ y + x . 𝑦ത
1. We assign the value 1 to each logical variable and the value 0 to each
complemented logical variable.
2. In the truth table, we put ones in the cells corresponding to the different
combinations appearing in the Boolean function.
3. For the other combinations that do not appear in the Boolean function, we put
zeros.
17
Boolean algebra
3. Logic functions
Representation of Boolean functions
B. Transition from truth table to algebraic form
1. We only consider, in the truth table, the combinations for which the
Boolean function is equal to 1.
2. In the combination, we replace the 1s by the variables and the 0s by their
complements. Thus each combination will correspond to the logical
multiplication of its variables or their complements.
3. The Boolean function will be the logical sum of all the logical
multiplication already found in 2.
18
Boolean algebra
3. Logic Functions
One-variable Boolean functions
A single-variable Boolean function is a function that associates the value 0 or 1
with a Boolean variable.
19
Boolean algebra
3. Logic Functions
Two-variable Boolean functions
Let f be a Boolean function with two variables 𝒂 and 𝒃.
ഥ 𝑏ത + α1 𝑎.
F(a,b) = α0 𝑎. ത 𝑏 + α2 𝑎. 𝑏ത + α3 𝑎. 𝑏 with α𝒊 є {0,1}
Each combination α𝟎 α𝟏 α𝟐 α𝟑 corresponds a Boolean function f𝒊
With two variables, we can define 16 functions
20
Boolean algebra
3. Logic Functions
N-variable Boolean functions
Generalization :
𝑁
With N variables, we can define 22 Boolean fonctions.
21
Boolean algebra
3. Logic Functions
Schematic representation of a Boolean function (Logigram)
Example :
Y(A,B,C) = ((𝐴 + 𝐵 .C) + ഥ𝐶
22
Boolean algebra
4. Canonical Forms
Definitions
Canonical term
An algebraic term is canonical if it includes an occurrence of each logic variable
involved in the Boolean function.
We call Minterm of n variables a logical multiplication of these variables.
We call Maxterm of n variables a logical sum of these variables.
With n variables, we can have 𝟐𝒏 Minterms and 𝟐𝒏 Maxterms.
23
Boolean algebra
4. Canonical Forms
Canonical function
A logic function expressed in canonical form if it is composed only of canonical
terms.
There are two Canonical Forms for each logic function:
The disjunctive form (called also 1st CF)
The conjunctive form (called also 2nd CF)
Expression of a logical function using minterms and maxterms
A Boolean function can be expressed in algebraic form from its truth table:
1. It is equal to the sum of the minterms for which the logic function is equal to
1 → Disjunctive form.
2. It is equal to the product of the maxterms for which the logic function is equal
to 0 → Conjunctive form.
24
Boolean algebra
4. Canonical forms
Conversions between canonical forms
To switch from canonical disjunctive to canonical conjunctive form, simply
replace all the function's minterms by maxterms with indices different from
those of the minterms.
To switch from canonical conjunctive to the canonical disjunctive form, simply
replace all the function's maxterms with minterms having indices different from
those of the maxterms.
25
Boolean algebra
5. Simplification of Boolean functions
Simplifying a logic function means reducing the number of its terms or the number
of logical variables in the same term.
The algebraic method : is recommended when the number of logical variables
is less than 4.
Karnaugh method : is limited to logical functions with no more than 6 logical
variables.
26
Boolean algebra
5. Simplification of Boolean functions
B. Karnaugh table
Definition
Presentation of the truth table in the form of a table whose input variable values are
represented in Gray code.
For a logical function with one variable, the table will contain a single cell that can take the
value 0 or 1.
For a logical function with n variables, the table will contain 2𝑛 cells.
Example:
Let the logical function :
S(a,b,c) = 𝑎. ത 𝑐ҧ + 𝑎.𝑏.
ത 𝑏. ത 𝑐 + a.𝑏. 𝑐ҧ + a.b. 𝑐
ത 𝑐ҧ + 𝑎.𝑏.
27
Boolean algebra
5. Simplification of Boolean functions
B. Karnaugh table
The transition from the truth table to the Karnaugh table consists of :
1. The function must be in its 1st CF.
2. For each minterm of the logical function, a 1 is placed in the corresponding
cell in the table.
3. Once the table is completed, we can proceed with the simplification.
28
Boolean algebra
5. Simplification of Boolean functions
B. Karnaugh table
The Karnaugh simplification method consists of :
Circle any group of cells occupied by adjacent 1s on the same row or the same
column. A cell can be circled twice. If a 1 is isolated (not adjacent to any other
1), circle it by itself.
Within the same group of 1s, if a variable changes value, it is eliminated;
otherwise, it is kept.
The simplified logic function is the logical sum of all the terms reduced in this
way.
29
Boolean algebra
5. Simplification of Boolean functions
Karnaugh table for a 5-variable logic function
Definition
Each cell will have five adjacent cells. As you can see in the following figure, cell 𝑚7 has
five adjacent cells, four of which are located in the same quadrant, while the fifth cell is
located in the adjacent quadrant.
30