CPCS 222 Discrete Structures I Boolean Algebra
CPCS 222 Discrete Structures I Boolean Algebra
CPCS 222
Discrete Structures I
Boolean Algebra
Dr. Eng. Farag Elnagahy
farahelnagahy@hotmail.com
Office Phone: 67967
Boolean Functions
Boolean algebra provides the operations and
the rules for working with the set {0, 1}.
The complement is
denoted by a bar.
It is defined by
Not Gate “Inverter”
0=1 1=0
4
Boolean Functions and Logic Gates
NAND and NOR are two very important gates.
Their symbols and truth tables are shown below
NAND NAND
x y = x y
NOR
x y= x + y
NOR
5
Boolean Functions
6
Boolean Functions
The complement, Boolean sum, and Boolean
product correspond the Logical operators ,
, and respectively, where
0 corresponds to F , and 1 corresponds to T.
10+ (0+1)=0
Its logical equivalent is
(T F) (F T) F
7
Boolean Expressions and Boolean Functions
8
Boolean Expressions and Boolean Functions
this function 0 1 0
From B2 To B 1 0 1
1 1 0
9
Boolean Expressions and Boolean Functions
101
100
010
011
000 001
12
Boolean Expressions and Boolean Functions
13
Boolean Expressions and Boolean Functions
14
Boolean Expressions and Boolean Functions
Question: How many different Boolean functions
of degree 4 are there? 16
15
Boolean Expressions and Boolean Functions
x F1 F2 F3 F4
0 0 0 1 1
1 0 1 0 1
16
Identities of Boolean algebra
17
Identities of Boolean algebra
18
Identities of Boolean algebra
19
Identities of Boolean algebra
20
Identities of Boolean algebra (Duality)
There are useful identities of Boolean expressions that
can help us to transform an expression A into an
equivalent expression B (see previous table)
We can derive additional identities with the help of the
dual of a Boolean expression.
Duality principle
The Boolean equation remains valid if we take the dual
of the expression on both sides of the equals sign.
The dual of a Boolean expression is obtained by
interchanging Boolean sums and Boolean products and
interchanging 0s and 1s.
21
Identities of Boolean algebra (Duality)
Examples:
The dual of x(y + z) is x + yz
The dual of x1 + (y + z) is (x + 0) ( y . z).
23
Definition of a Boolean Algebra
All the properties of Boolean functions and
expressions that we have discovered also apply to
other mathematical structures such as
propositions and sets and the operations defined on
them.
If we can show that a particular structure is a
Boolean algebra, then we know that all results
established about Boolean algebras apply to this
structure.
For this purpose, we need an abstract definition of
a Boolean algebra.
24
Definition of a Boolean Algebra
Definition: A Boolean algebra is a set B with two
binary operations and , elements 0 and 1, and a
unary operation – such that the following
properties hold for all x, y, and z in B:
x 0 = x and x 1 = x (identity laws)
x (x) = 1 and x (x) = 0 (Complement laws)
(x y) z = x (y z) and
(x y) z = x (y z) and (associative laws)
x y = y x and x y = y x (commutative laws)
x (y z) = (x y) (x z) and
x (y z) = (x y) (x z) (distributive laws)
25
Exercises
pp. (756-757)
1-3
5
7
9-10
12-13
24-28
26
Representing Boolean Functions
Two important problems of Boolean algebra will
be studied in the next slides:
27
Representing Boolean Functions
Any Boolean function can be represented as a :
Sum of products (SOP) of variables and their
complements. Disjunctive normal form (DNF)
Sum-of-products Expansions
Or
Product of sums (POS) of variables and their
complements. Conjunctive normal form (CNF)
Product-of-sums Expansions
28
Representing Boolean Functions
A literal is a Boolean variable or its complement.
A minterm of Boolean variables x1,…,xn is a
Boolean product of n literals y1 y2 …yn, where yi is
either the literal xi or its complement xi.
Note that the minterm y1 y2 …yn has the value 1
Iff each yi is 1.
30
Representing Boolean Functions
Find Boolean expressions that represent the
function F(A,B,C) which is given in the following
table.
31
Representing Boolean Functions
Sum-of-products Expansions (DNF)
32
Representing Boolean Functions
33
Representing Boolean Functions
34
Representing Boolean Functions
35
Representing Boolean Functions
For example
36
Representing Boolean Functions
Example Find a minterm that equal 1 if x1= x3=0
and x2= x4=x5=1 and equals 0 otherwise.
The minterm is x1 x2 x3 x4 x5
38
Representing Boolean Functions
Is there a smaller set of operators that can be used
to represent all Boolean functions?
Both of the sets { } and {} are functionally complete.
NAND x y = x y
NOR
x y= x + y
x = x x x = x x
xy = (x y) (x y) x+y = (x y) (x y)
41
Combinations of Gates
Construct the circuit that produces the following output:
42
Combinations of Gates
A committee of three individuals decides issues for
an organization. Each individual votes either yes or no
for each proposal that arises. A proposal is passed if it
receives at least two yes votes. Design a circuit that
determines whether a proposal passes.
43
Combinations of Gates (half adder)
Combinational logic circuits give us many useful
devices.
One of the simplest is the half adder, which finds
the sum of two bits.
We can gain some insight as to the construction of a
half adder by looking at its truth table
44
Combinations of Gates (half adder)
x
y Sum
Carry
45
Combinations of Gates (full adder)
We can change our half adder into to a full adder by
including gates for processing the carry bit.
The truth table for a full adder is shown below.
46
Combinations of Gates (full adder)
47
Exercises
pp. (765-766)
1-6
10-11
13-19
48
Minimization of Circuits
Karnaugh Maps
It is a graphical approach used to simplify a Boolean
function (sum of products expansion).
Let F(A,B) be a sum-of-products Boolean expression.
To minimize F, we use a rectangular array of two rows
and two columns in which rows and columns are labeled as
follows:
Two variables
22 possible
Minterms.
Each square is called a cell corresponds to a minterm.
Cells are called adjacent if the minterms that they
represent differ in exactly one literal. 49
Minimization of Circuits
A two-variables Karnaugh Map
If a minterm is present in F(A,B), then we place a 1 in
the cell corresponding to the minterm, otherwise the
cell is left empty or place a O.
The resulting array is called K-map corresponding to
the expression
50
Minimization of Circuits
A two-variables Karnaugh Map
Find Boolean expressions that represent the function
F(A,B) which is given in the following table.
51
Minimization of Circuits
A Three-variables Karnaugh Map
52
Minimization of Circuits
A four-variables Karnaugh Map
53
Exercises
pp. (779-780)
1-2
6-7
12
54