0% found this document useful (0 votes)
71 views54 pages

CPCS 222 Discrete Structures I Boolean Algebra

The document discusses Boolean algebra and how it can be used to represent Boolean functions. It covers topics like Boolean operations, logic gates, Boolean expressions, identities in Boolean algebra, and representing Boolean functions using sums of products and products of sums. It also defines key concepts like literals, minterms, and maxterms used to represent Boolean functions as algebraic expressions.

Uploaded by

Among Ass
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
Download as ppt, pdf, or txt
0% found this document useful (0 votes)
71 views54 pages

CPCS 222 Discrete Structures I Boolean Algebra

The document discusses Boolean algebra and how it can be used to represent Boolean functions. It covers topics like Boolean operations, logic gates, Boolean expressions, identities in Boolean algebra, and representing Boolean functions using sums of products and products of sums. It also defines key concepts like literals, minterms, and maxterms used to represent Boolean functions as algebraic expressions.

Uploaded by

Among Ass
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1/ 54

King ABDUL AZIZ University

Faculty Of Computing and


Information Technology

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}.

 Electronic and optical switches can be


studied using this set and the rules of
Boolean algebra.

We are going to focus on three operations:


• Boolean complementation,
• Boolean sum, and
• Boolean product 2
Boolean Functions and Logic Gates

The complement is
denoted by a bar.
It is defined by
Not Gate “Inverter”
0=1 1=0

The Boolean sum,


denoted by + or by OR
(inclusive OR), has the
following values: OR Gate
1+1=1 1+0=1
0+1=1 0+0=0
3
Boolean Functions and Logic Gates
The Boolean product,
denoted by  or by
AND, has the
AND Gate
following values:
11=1 10=0
01=0 00=0

XOR (exclusive OR)


11=0 10=1 XOR Gate
01=1 00=0
xy =xy+xy

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.

10+ (0+1)=0
Its logical equivalent is
(T  F)  (F  T)  F

7
Boolean Expressions and Boolean Functions

Definition: Let B = {0, 1}. The variable x is called


a Boolean variable if it assumes values only from
B.
A function from Bn, the set {(x1, x2, …, xn) |xiB,
1  i  n}, to B is called a Boolean function of
degree n.

Boolean functions can be represented using


expressions made up from the variables and
Boolean operations.

8
Boolean Expressions and Boolean Functions

Example: the function F(x,y)=xy from the set


of ordered pairs of Boolean variable to the
set {0, 1} is a Boolean function of degree 2
with F(1,1)=0, F(1,0)=1, F(0,1)=0, and
F(0,0)=0.
x y F(x,y)
0 0 0

this function 0 1 0
From B2 To B 1 0 1
1 1 0
9
Boolean Expressions and Boolean Functions

The Boolean expressions in the variables


x1, x2, …, xn are defined recursively as:

 0,1,x1,x2,…,xn are Boolean expressions.


 If E1 and E2 are Boolean expressions, then
E1, E1E2, and E1+E2 are Boolean expressions.

Each Boolean expression represents a Boolean


function. The values of this function are
obtained by substituting 0 and 1 for the
variables in the expression.
10
Boolean Expressions and Boolean Functions

Example: Find the value of the Boolean function


F(x,y,z)=xy+z (this function From B3 To B)

Definition: The Boolean functions F and G of n


variables are equal if and only if
F(b1, b2, …, bn) = G(b1, b2, …, bn)
whenever b1, b2, …, bn belong to B.
Two different Boolean expressions that represent the
same function are called equivalent.
For example, the Boolean expressions xy, xy+0,
and xy1 are equivalent 11
Boolean Expressions and Boolean Functions

Example: Find the value of the Boolean function


F(x,y,z)=xy+z (this function From B3 To B)

A Boolean function of degree n can be represented by an


n-cube (hypercube) with the corresponding function value
at each vertex.
110 111

101
100

010
011

000 001
12
Boolean Expressions and Boolean Functions

The complement of the Boolean function F is the


function F
where F(b1, b2, …, bn) = F(b1, b2, …, bn)

Let F and G be Boolean functions of degree n.


The Boolean sum F+G is defined by
(F+G)(b1,b2,…,bn) = F(b1,b2, …,bn)+G(b1,b2,…,bn)
and Boolean product FG is defined by
(FG)(b1,b2, …,bn) = F(b1,b2, …,bn) G(b1,b2, …,bn)

13
Boolean Expressions and Boolean Functions

Question: How many different Boolean functions


of degree n are there?
Solution:
There are 2n different n-tuples of 0s and 1s.
A Boolean function is an assignment of 0 or 1 to
each of these 2n different n-tuples.
n
Therefore, there are 2 2
different 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

Question: How many different Boolean functions


of degree 1 are there?
Solution: There are four of them, F1,F2,F3, and
F4

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 x1 + (y + z) is (x + 0) ( y . z).

The dual of a Boolean function F represented by a


Boolean expression is the function represented by
the dual of this expression.
This dual function, denoted by Fd, does not depend
on the particular Boolean expression used to
represent F.
22
Identities of Boolean algebra (Duality)
Therefore, an identity between functions
represented by Boolean expressions remains valid
when the duals of both sides of the identity are
taken.
We can use this fact, called the duality principle,
to derive new identities.
For example, consider the absorption law
x(x + y) = x.
By taking the duals of both sides of this identity,
we obtain the equation x + xy = x, which is also an
identity (and also called an absorption law).

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:

 Given the value of a Boolean function, how can


a Boolean expression that represents this
function be found?

 Is there a smaller set of operators that can


be used to represent all Boolean functions?

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.

 A maxterm of Boolean variables x1,…,xn is a


Boolean sum of n literals y1 y2 …yn, where yi is either
the literal xi or its complement xi.
Note that the maxterm y1 y2 …yn has the value 0
Iff each yi is 0. 29
Representing Boolean Functions
Minterms and maxterms
The table below illustrates the minterms and
maxterms for three input Boolean variables

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)

Product -of- sums Expansions (CNF)

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

Example Find the sum-of-products expansion for


the function F(x,y,z)=(x+y)z (truth table)
F(x,y,z)=(x+y)z
=xz+yz Distributive law
=x1z+1yz Identity law
=x(y+y)z+(x+x)yz Unity law
=xy z+xyz+xyz+xyz Distributive law
=xy z+xyz+xyz Idempotent law 37
Representing Boolean Functions
 Is there a smaller set of operators that can be used
to represent all Boolean functions?
Every Boolean function can be represented using the
Boolean operators + , . , and . So, we say that the
set {+ , ., } is functionally complete.

We can eliminate all the + using this entity


Then set { ., } is functionally complete.

We can eliminate all the . using this entity


Then set { +, } is functionally complete.

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)

x+y using NAND how?


xy using NOR
39
Representing Boolean Functions

Exercises pp. 760


1-6
12-15 40
Combinations of Gates
Logic gates can have one or more inputs

Construct the circuit that produces the following output:

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.

 Sometimes light fixtures are controlled by more than


switch. Circuits needed to be designed so that flipping
any one of the switches for the fixture turns the light
on when it is off and turns the light off when it is on.
Design circuits that accomplish this when there are two
switches and when there are three switches.

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.

Don’t care condition ? x

51
Minimization of Circuits
A Three-variables Karnaugh Map

Use K-Map to find a minimal expansion of the


function, and draw the circuit diagram.

52
Minimization of Circuits
A four-variables Karnaugh Map

Use K-Map to find a minimal


expansion of the function, and
draw the circuit diagram.

53
Exercises

pp. (779-780)
1-2
6-7
12

54

You might also like