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

Boolean Functions and Expressions

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 defined on Bn .

Boolean functions can be represented using expressions made


up from the variables and Boolean operations.

? Determine number of elements in Boolean


algebra of set of all functions from set Bn
to {0,1}. Such functions are called Boolean
functions.
n
2
2
Boolean Functions and Expressions

The Boolean expressions in the variables x1, x2, …, xn are


defined recursively as follows:
x1, x2, …, xn are Boolean expressions.
If f1 and f2 are Boolean expressions, then (f1)′
(f1f2), and (f1 + f2) 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.
Boolean Functions and Expressions

Question: How many different Boolean functions B →B 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
Boolean Functions and Expressions

Question: How many different Boolean functions B×B →B


are there?
Solution: There are 16 of them, F1, F2, …, F16:

x y F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15 F16

0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1

0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1

1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1
When two Boolean functions are same ?

If there values are same for same


values of Boolean variables?
f(x,y,z) =xy′+xyz′+x′yz′
x y z f(x, y, z) f(x, y, z)+xz′
f(x,y,z)+x
0 0 0 0 0

0 0 1 0 0

0 1 0 1 1

0 1 1 0 0

1 0 0 1 1

1 0 1 1 1

1 1 0 1 1

1 1 1 0 0
Boolean Functions and Expressions

Example: Give a Boolean expression for the Boolean function


F(x, y) as defined by the following table:

x y F(x, y)
0 0 0
0 1 1
1 0 0
1 1 0

Possible solution I: F(x, y) = (x′)y


Possible solution II: F(x, y) = (x+y)(x′+y)(x′+y′)
Boolean Functions and Expressions
Example: Give a Boolean expression for the Boolean function
F(x, y,z) as defined by the following table
Possible solution I:
x y z F(x, y, z)

0 0 0 1 F(x, y, z) = (xz +
0 0 1 1 y)′
Possible solution II:
0 1 0 0

0 1 1 0 F(x, y, z) =((xz) ′)(y′)


Possible solution III:
1 0 0 1

1 0 1 0 F(x, y, z)
1 1 0 0

1 1 1 0
= x ′ y ′ z ′+ x ′ y ′ z+ x y ′
z′
Boolean Functions and Expressions
There is a simple method for deriving a Boolean expression for
a function that is defined by a table. This method is based on
minterms & maxterms
Definition: A literal is a Boolean variable or its complement.
A minterm of the Boolean variables x1, x2, …, xn is a Boolean
product y1y2…yn, where yi = xi or yi = (xi) ′
Hence, a minterm is a product of n literals, with one literal for
each variable.
a maxterm is sum of of n distinct literals, with one literal for
each variable
Summary of Minterms and Maxterms
There are 2n minterms and 2n maxterms for Boolean
functions with n variables.Any Boolean function can
be expressed as a logical sum of minterms and as
a logical product of maxterms
Canonical Forms

Examples : In two variables

xy+ xy′ , x′y′ + xy+x′y

Examples : In three variables

xyz+ xy′z , x′y′z + xyz′ +x′yz


Disjunctive normal form is a sum of minterms
the form is as well written as Minterm form
or sum of products Canonical form.

Conjunctive normal form is product of


maxterms the form is as well written as
maxterm form or product of sum canonical
form
Question 1 : For F(x,y,z) find disjunctive normal form
Therefore disjunctive
x y z F(x, y, z) normal form is ,
0 0 0 1
0 0 1 1 F(x, y, z)
0 1 0 0
0 1 1 0 =1.(x′y′z′)+1.(x′y′z)
1 0 0 1
1 0 1 0 +0. (x′yz′)
1 1 0 0
+0.(x′yz)+1.(xy′z′) +
1 1 1 0

0.(xy′z)+0.
(xyz′)+0.(xyz)
Comment : Disjunctive normal form is nothing more
than the sum of those three minterms which
correspond to the combination of values of xyz for
which f takes the value 1
F(x, y, z) =(x′)(y′)(z′) +(x′)(y′)z +x(y′)(z′)
x y z F(x, y, z)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 0
Question2 : For F(x,y,z) find conjunctive normal form

F(x, y, z) = 0 if and only if: x= 0


=z, y = 1 or y = z =1, x = 0 or
x y z F(x, y, z)
x = 1, y =0 z = 1 or
0 0 0 1
x = y = 1, z = 0 or
0 0 1 1

0 1 0 0 x = y = z = 1 Therefore
0 1 1 0
Conjunctive normal form
1 0 0 1
is
1 0 1 0

1 1 0 0

1 1 1 0
x y z F(x, y, z) F(x,y,z)=(1+x+y+z)(1+x+y+z′)
0 0 0 1
0 0 1 1 (0+x + y′+z)(0+x+y′ +z′) (1+x′ +y +
0 1 0 0
z)
0 1 1 0
1 0 0 1
.(0+x′+y+z′)(0+x′+y′+z)
1 0 1 0
1 1 0 0 (0+x′+y′+z′)
1 1 1 0

F(x,y,z) =(x+y′+z))(x+y′+z′)(x′+y+z′)(x′+y′+z) (x′+y′+ z′ )

Comment : Conjunctive normal form is


nothing more than the product of
those five maxterms which correspond
to the combination of values of x ,y, z
for which f takes the value 0
Theorem: Let n = p1p2….pm,
where the pi are distinct primes.
then (Dn ,|) is a Boolean algebra.
2 : Obtain the sum of products canonical form
of the following expressions
(i) x ⊕y (ii) (x ⊕y)′ ⊕(x′ ⊕ z)
(iii) xy′+z (iv)x′+ [(y+z′)(yz)′](x+yz′)

Solution :
(i) x ⊕y = xy′ +x′y

Solution :
(ii) (x ⊕y)′ ⊕(x′ ⊕ z) = (xy′ +x′y)′ ⊕(x′z′+xz)
(xy′ +x′y)′ ⊕(x′z′+xz)
x y z (xy′ +x′y)′ x′z′+xz f(x,y,z)

0 0 0 1 1 0

0 0 1 1 0 1

0 1 0 0 1 1

0 1 1 0 0 0

1 0 0 0 0 0

1 0 1 0 1 1

1 1 0 1 0 1

1 1 1 1 1 0

Sum of products Canonical forms :


x′y′z+ x′yz′ + x y ′z +xyz′
(iii) xy′+z = xy′(z+z′)+ (x+x′ )(y+y′)(z)
= xy′z+ xy′z′+ (x+x′ )(yz+y′z)

= xy′z + xy′z′+xyz+xy′z+x′yz+x′y′z

= xy′z + xy′z′+xyz+x′yz+x′y′z
KARNAUGH MAP
Simplifying Expression
 Find blocks (rectangles) of 1s in K-map

F= x’y’ + xy’ = y’
y
0 1
x

0
1 0
From truth table From K-map
1 1 0
karnaugh Maps

y
X Y F 0 1
x
0 0 0
0
0 0
0 1 0
1 0 1 1 1 1
1 1 1
Simplifying expression
Find blocks (rectangles) of 1s in k-map

This row represents X=1


y
0 1 F= xy’ + xy’ = x
x

0
0 0
From truth table From K-map
1 1 1
Following are the rules for forming basic
rectangles our aim is to include maximum
number of 1's in a basic rectangle and to find
minimum number of such rectangles.
A rectangle must contain 1, 2, 4, 8, 16, …. cells, i.e.
in the power of 2.
Cells which are in a rectangle , should be adjacent
cells, i.e. horizontal or vertical, not diagonal.
Rectangles should not include any cell containing zero

Rectangles must contain as many 1's as possible


Rectangles may intersect

Rectangles may wrap around the table. The left most


square in a row may be combined with rightmost and
the top square in a column may be combined with the
bottom . Squares in corners of the map are also
adjacent, for that purpose
Simplifying expression
Find blocks (rectangles) of 1s in K-map

This row represents X=0


y This column represents Y=1
0 1
x

0
1 1 F= x′y’ + x′y +xy = x′+y

1 0 1
From truth table From K-map
3-Variable karnaughmap
karnaugh map with 3 variables

yz
00 01 11 10
x
= 1 if x’y′z’ is = 1 if x’y′z = 1 if x’yzis = 1 if x’yz′
0 a minterm is a minterm a minterm is a minterm
in f in f in f in f

= 1 if xy′z′s = 1 if xy’z is = 1 if xyzis = 1 if xyz’ is


a minterm a minterm a minterm a minterm
in f in f in f in f
1
3-Variable karnaughmap
Example : Draw the K-map for the expression f = x’yz’ + xy’z’ +xy’z

yz
x 00 01 11 10

0 0 0 0 1
1 1 1 0 0
3-Variable K- map
Example : Draw Karnaugh map and simplify expression f = x’yz’ + xy’z’ +xy’z

yz
x 00 01 11 10

0 1
1 1 1
3-Variable k-map
yz
x 00 01 11 10
x y z f
0 1 1 1 0
0 0 0 1
1 1 1 1 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
3-Variable k-map
yz
x 00 01 11 10
x y z f
0 1 1 1 0
0 0 0 1
1 1 1 1 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
F = Y’ + Z how ?
1 0 1 1
1 1 0 0
1 1 1 1
Four-variable k- map
Simplifying 4-variable k-map
yz
00 01 11 10
wx

1 1 0 0
00

01
1 1 0 0

11 1 1 0 0

10 1 1 0 0
4-variable K-map
yz
00 01 11 10
wx

1 1 0 0
00

01
1 1 0 0

11 1 1 0 0

10 1 1 0 0

F(x,y,z)=y′
Simplifying 4-variable k-map
yz
00 01 11 10
wx

0 1 1 0
00

01
1 1 1 0

11 1 0 0 0

10 0 0 0 1
yz

x′y′w

=x′y′w+yz+xy′zw′
Example
yz
00 01 11 10
wx

0 1 1 0
00

01
1 1 1 0

11 1 0 1 1

10 0 0 1 1
yz
00 01 11 10
wx

0 1 1 0
00

01
1 1 1 0

11 1 0 1 1

10 0 0 1 1
Minimum number of maximal basic rectangles that cover all 1
yz
00 01 11 10
wx

0 1 1 0
00

01
1 1 1 0

11 1 0 1 1

10 0 0 1 1

F(x,y,z)= w′z+yw+y′z′x
4-variable k-map simplify
yz
00 01 11 10
wx

1 1 1 1
00

01
0 1 0 0

11 0 1 1 1

10 1 1 1 1

Choose minimum number of maximal basic rectangles to cover


all 1’s
First and fourth row combined form one maximal basic rectangle

yz
00 01 11 10
wx

1 1 1 1
00

01
0 1 0 0

11 0 1 1 1

10 1 1 1 1

2nd column is yet other maximal basic rectangle


We are still left with few of 1’s in third row that are not
Yet covered hence we choose a maximal basic rectangle that
Contains them

yz
00 01 11 10
wx

1 1 1 1
00

01
0 1 0 0

11 0 1 1 1

10 1 1 1 1

If u choose Rectangle that just Contains 1’s


Of 3rd row that are in 3rd and 4th column then that is not maximal
Now we can write minimal expression as

x ′+y′z′+yw how ?

yz
00 01 11 10
wx

1 1 1 1
00

01
0 1 0 0

11 0 1 1 1

10 1 1 1 1
First term is for x′ is for 1st maximal basic rectangle
y′z′ is for maximal basic rectangle in 2nd column yw is for 3rd maximal basic
rectangle

yz
00 01 11 10
wx

1 1 1 1
00

01
0 1 0 0

11 0 1 1 1

10 1 1 1 1

minimal expression is x ′+y′z′+yw


4-variable k-map
yz
00 01 11 10
wx

0 1 1 0
00

01
1 1 1 0

11 1 0 1 1

10 1 0 1 1
4-variable k-map simplify
yz
00 01 11 10
wx

1 0 0 1
00

01
0 1 0 0

11 1 1 1 1

10 1 1 1 1
4-variable k-map
yz
00 01 11 10
wx

1 0 0 1
00

01
0 1 0 0

11 1 1 1 1

10 1 1 1 1

w+ z′x′ +xy′z how ?


4-variable k-map simplify
yz
00 01 11 10
wx

0 1 1 0
00

01
1 1 1 0

11 1 0 1 1

10 1 0 1 1
4-variable k-map simplify
yz
00 01 11 10
wx

1 1 1 1
00

01
1 1 0 0

11 0 1 1 1

10 1 1 1 1
Simplify
yz
00 01 11 10
wx

1 1 1 0
00

01
1 1 1 0

11 1 1 1 1

10 0 0 1 1
Simplify
yz
00 01 11 10
wx

1 1 1 0
00

01
1 1 1 0

11 1 0 1 1

10 1 0 1 1
Simplify
yz
00 01 11 10
wx

1 1 1 0
00

01
1 1 1 1

11 1 0 1 1

10 1 0 1 1

You might also like