Download presentation
Presentation is loading. Please wait.
Published byJasmin Mathews Modified over 9 years ago
1
Dr. Eng. Farag Elnagahy farahelnagahy@hotmail.com Office Phone: 67967 King ABDUL AZIZ University Faculty Of Computing and Information Technology CPCS 222 Discrete Structures I Boolean Algebra
2
2 Boolean Functions Boolean algebra provides the operations and the rules for working with the set {0, 1}. the rules for working with the set {0, 1}. Electronic and optical switches can be Electronic and optical switches can be studied using this set and the rules of studied using this set and the rules of Boolean algebra. Boolean algebra. We are going to focus on three operations: Boolean complementation, Boolean complementation, Boolean sum, and Boolean sum, and Boolean product Boolean product
3
3 Boolean Functions and Logic Gates The complement is denoted by a bar. It is defined by 0=1 1=0 The Boolean sum, denoted by + or by OR (inclusive OR), has the following values: 1+1=1 1+0=1 0+1=1 0+0=0 Not Gate “Inverter” OR Gate
4
4 The Boolean product, denoted by or by AND, has the following values: 1 1=1 1 0=0 0 1=0 0 0=0 XOR (exclusive OR) 1 1=0 1 0=1 0 1=1 0 0=0 x y =xy+xy Boolean Functions and Logic Gates AND Gate XOR Gate
5
5 NAND and NOR are two very important gates. Their symbols and truth tables are shown below Boolean Functions and Logic Gates NOR NAND x y = x y x y= x + y NAND NOR
6
6 Boolean Functions
7
7 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 1 0+ (0+1)=0 Its logical equivalent is (T F) (F T) F (T F) (F T) F
8
8 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 B n, the set {(x 1, x 2, …, x n ) |x i 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.
9
9 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. this function From B 2 To B xyF(x,y) 000 010 101 110
10
10 Boolean Expressions and Boolean Functions The Boolean expressions in the variables x 1, x 2, …, x n are defined recursively as: 0,1,x 1,x 2,…,x n are Boolean expressions. If E 1 and E 2 are Boolean expressions, then E 1, E 1 E 2, and E 1 +E 2 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.
11
11 Boolean Expressions and Boolean Functions Example: Find the value of the Boolean function F(x,y,z)=xy+z (this function From B 3 To B) Definition: The Boolean functions F and G of n variables are equal if and only if F(b 1, b 2, …, b n ) = G(b 1, b 2, …, b n ) whenever b 1, b 2, …, b n 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
12
12 Example: Find the value of the Boolean function F(x,y,z)=xy+z (this function From B 3 To B) A Boolean function of degree n can be represented by an n-cube (hypercube) with the corresponding function value at each vertex. Boolean Expressions and Boolean Functions 001 111110 011 100 010 000 101
13
13 Boolean Expressions and Boolean Functions The complement of the Boolean function F is the function F function F where F(b 1, b 2, …, b n ) = F(b 1, b 2, …, b n ) Let F and G be Boolean functions of degree n. The Boolean sum F+G is defined by (F+G)(b 1,b 2,…,b n ) = F(b 1,b 2, …,b n )+G(b 1,b 2,…,b n ) and Boolean product FG is defined by (FG)(b 1,b 2, …,b n ) = F(b 1,b 2, …,b n ) G(b 1,b 2, …,b n )
14
14 Boolean Expressions and Boolean Functions Question: How many different Boolean functions of degree n are there? Solution: There are 2 n different n-tuples of 0s and 1s. A Boolean function is an assignment of 0 or 1 to each of these 2 n different n-tuples. Therefore, there are 2 2 n different Boolean functions.
15
15 Boolean Expressions and Boolean Functions Question: How many different Boolean functions of degree 4 are there? 16
16
16 Boolean Expressions and Boolean Functions Question: How many different Boolean functions of degree 1 are there? Solution: There are four of them, F 1,F 2,F 3, and F 4 xF1F1 F2F2 F3F3 F4F4 00011 10101
17
17 Identities of Boolean algebra
18
18 Identities of Boolean algebra
19
19 Identities of Boolean algebra
20
20 Identities of Boolean algebra
21
21 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.
22
22 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 F d, does not depend on the particular Boolean expression used to represent F.
23
23 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).
24
24 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.
25
25 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)
26
26 Exercises pp. (756-757) 1-3579-1012-1324-28
27
27 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?
28
28 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
29
29 Representing Boolean Functions A literal is a Boolean variable or its complement. A minterm of Boolean variables x 1,…,x n is a Boolean product of n literals y 1 y 2 …y n, where y i is either the literal x i or its complement x i. Note that the minterm y 1 y 2 …y n has the value 1 Note that the minterm y 1 y 2 …y n has the value 1 Iff each y i is 1. A maxterm of Boolean variables x 1,…,x n is a Boolean sum of n literals y 1 y 2 …y n, where y i is either the literal x i or its complement x i. Note that the maxterm y 1 y 2 …y n has the value 0 Note that the maxterm y 1 y 2 …y n has the value 0 Iff each y i is 0.
30
30 Representing Boolean Functions Minterms and maxterms The table below illustrates the minterms and maxterms for three input Boolean variables
31
31 Representing Boolean Functions Find Boolean expressions that represent the function F(A,B,C) which is given in the following table.
32
32 Representing Boolean Functions Sum-of-products Expansions (DNF) Product -of- sums Expansions (CNF)
33
33 Representing Boolean Functions
34
34 Representing Boolean Functions
35
35 Representing Boolean Functions
36
36 Representing Boolean Functions For example
37
37 Representing Boolean Functions Example Find a minterm that equal 1 if x 1 = x 3 =0 and x 2 = x 4 =x 5 =1 and equals 0 otherwise. and x 2 = x 4 =x 5 =1 and equals 0 otherwise. The minterm is x 1 x 2 x 3 x 4 x 5 Example Find the sum-of-products expansion for the function F(x,y,z)=(x+y)z (truth table) the function F(x,y,z)=(x+y)z (truth table)F(x,y,z)=(x+y)z =xz+yz Distributive law =xz+yz Distributive law =x1z+1yz Identity law =x1z+1yz Identity law =x(y+y)z+(x+x)yz Unity law =x(y+y)z+(x+x)yz Unity law =xy z+xyz+xyz+xyz Distributive law =xy z+xyz+xyz+xyz Distributive law =xy z+xyz+xyz Idempotent law =xy z+xyz+xyz Idempotent law
38
38 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.
39
39 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. x+y using NAND how? xy using NOR x y = x y x y= x + y NAND NOR x = x x xy = (x y) (x y) x = x x x+y = (x y) (x y)
40
40 Representing Boolean Functions Exercises pp. 760 1-612-15
41
41 Combinations of Gates Logic gates can have one or more inputs Construct the circuit that produces the following output:
42
42 Combinations of Gates Construct the circuit that produces the following output:
43
43 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 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. 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.
44
44 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
45
45 Combinations of Gates ( half adder )
46
46 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.
47
47 Combinations of Gates ( full adder )
48
48 pp. (765-766) 1-610-1113-19 Exercises
49
49 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 Two variables 2 2 possible 2 2 possible Minterms. 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.
50
50 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 Minimization of Circuits
51
51 A two-variables Karnaugh Map Find Boolean expressions that represent the function F(A,B) which is given in the following table. Minimization of Circuits Don’t care condition ? x
52
52 A Three-variables Karnaugh Map Minimization of Circuits Use K-Map to find a minimal expansion of the function, and draw the circuit diagram.
53
53 A four-variables Karnaugh Map Minimization of Circuits Use K-Map to find a minimal expansion of the function, and draw the circuit diagram.
54
54 pp. (779-780) 1-26-712 Exercises
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.