Boolean Algebra and Logic Gate
-
Upload
khangminh22 -
Category
Documents
-
view
6 -
download
0
Transcript of Boolean Algebra and Logic Gate
Digital Circuits
Boolean Algebra and Logic Gate
Chapter 2
Boolean Algebra and Logic Gate
Dr. Marwa Fayez Fahmy
Lecture 4
Definition of Boolean Algebra
2
We need to define algebra for binary values
Developed by George Boole in 1854
Huntington postulates for Boolean algebra (1904):
B = {0, 1} and two binary operations, + and.
Closure with respect to operator + and operator ·
Identity element 0 for operator + and 1 for operator ·
Commutativity with respect to + and · x+y = y+x, x·y = y·x
Distributivity of · over +, and + over ·
x·(y+z) = (x·y)+(x·z) and x+(y·z) = (x+y)·(x+z)
Complement for every element x is x’ with x+x’=1, x·x’=0
There are at least two elements x,yB such that xy
2
Boolean Algebra
3
Terminology:
Literal: A variable or its complement
Product term: literals connected by •
Sum term: literals connected by +
3
4
Postulates (فرضية)مسلمه of Two-
Valued Boolean Algebra B = {0, 1} and two binary operations, + and.
The rules of operations: AND、OR and NOT.
1. Closure (+ and‧)
2. The identity elements (1) +: 0
(2).: 1
x y x.y
0 0 0
0 1 0
1 0 0
1 1 1
x y x+y
0 0 0
0 1 1
1 0 1
1 1 1
x x'
0 1
1 0
AND OR NOT
4
5
Postulates of Two-Valued Boolean Algebra
3. The commutative laws تبادلية
4. The distributive laws
x·(y+z) = (x·y)+(x·z) and
x+(y·z) = (x+y)·(x+z)
x y z y+z x.(y+z) x.y x.z (x.y)+(x.z)
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1 5
6
Postulates of Two-Valued Boolean Algebra
5. Complement
x+x'=1 → 0+0'=0+1=1; 1+1'=1+0=1
x.x'=0 → 0.0'=0.1=0; 1.1'=1.0=0
Note
A set of two elements
+ : OR operation; .: AND operation
A complement operator: NOT operation
Binary logic is a two-valued Boolean algebra
6
Dualityازدواجية
7
The principle of duality is an important concept. This says that if an expression is valid in Boolean algebra, the dual of that expression is also valid.
To form the dual of an expression, replace all + operators with . operators, all . operators with + operators, all ones with zeros, and all zeros with ones.
Form the dual of the expression
a + (bc) = (a + b)(a + c)
Following the replacement rules…
a(b + c) = ab + ac
Take care not to alter the location of the parentheses if they are present.
7
Boolean Theorems
9
Huntington’s postulates define some rules
Need more rules to modify algebraic expressions
Theorems that are derived from postulates
What is a theorem?
A formula or statement that is derived from postulates
(or other proven theorems)
Post. 1: closure Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0
9
Theorem 1: Idempotent التتاثر
11
denoting an element of a set which is unchanged in value when multiplied or otherwise operated on by itself.
Theorem 1(a): (x + x) = x
Theorem 1(b): (x.x)= x
11
Proof of x+x=x
12
We can only use Huntington postulates:
Show that x+x=x.
x+x = (x+x)·1 by 2(b)
= (x+x)(x+x’) by 5(a)
= x+xx’ by 4(b)
= x+0 by 5(b)
= x by 2(a)
Q.E.D.
We can now use Theorem 1(a) in future proofs
Huntington postulates: Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0
12
Proof of x·x=x
13
Similar to previous proof
Show that x·x = x. x·x = xx+0 by 2(a) = xx+xx’ by 5(b) = x(x+x’) by 4(a) = x·1 by 5(a) = x by 2(b) Q.E.D.
Huntington postulates: Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0 Th. 1: (a) x+x=x
13
Proof of x+1=1
15
Theorem 2(a): x + 1 = 1
x + 1 = 1.(x + 1) by 2(b)
=(x + x')(x + 1) 5(a)
= x + x' 1 4(b)
= x + x' 2(b)
= 1 5(a)
Theorem 2(b): x.0 = 0 by duality
Huntington postulates: Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0 Th. 1: (a) x+x=x
15
Involution Theorem
Theorem 3 : (x’)’ = x
Postulate 5 defines the complement of x, x + x' = 1 and x x' = 0
The complement of x' is x is also (x')’
By means of truth table
x x’ (x’)’
0 1 0
1 0 1
16 16
Associative Theorem
Theorem 4(a): (x + y)+z = x+(y+z)
Theorem 4(b): (x.y).z = x.(y.z)
By means of truth table
x y z x+y (x+y)+z y+z x+(y+z)
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 1 1 1 1
1 0 1 1 1 1 1
1 1 0 1 1 1 1
1 1 1 1 1 1 1 17 17
DeMorgan’s Theorem
Theorem 5(a): (x + y)’ = x’y’
Theorem 5(b): (xy)’ = x’ + y’
By means of truth table
x y x’ y’ x+y (x+y)’ x’y’ xy x’+y' (xy)’
0 0 1 1 0 1 1 0 1 1
0 1 1 0 1 0 0 0 1 1
1 0 0 1 1 0 0 0 1 1
1 1 0 0 1 0 0 1 0 0
18 18
Absorption Property (Covering)
Theorem 6(a): x + xy = x
x + xy = x.1 + xy by 2(b)
= x (1 + y) 4(a)
= x (y + 1) 3(a)
= x.1 Th 2(a)
= x 2(b)
Theorem 6(b): x (x + y) = x by duality Report
By means of truth table (another way to proof )
x y xy x+xy
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1
19
Huntington postulates: Post. 2: (a) x+0=x, (b) x·1=x Post. 3: (a) x+y=y+x, (b) x·y=y·x Post. 4: (a) x(y+z) = xy+xz, (b) x+yz = (x+y)(x+z) Post. 5: (a) x+x’=1, (b) x·x’=0 Th. 1: (a) x+x=x
19
Report
20
Proof That :
1. xy + x’z + yz = xy + x’z
2. (x+y)•(x’+z)•(y+z) = (x+y)•(x’+z) -- (dual)
20
• Annulment Law – A term AND´ed with a “0”
equals 0 or OR´ed with a “1” will equal 1
• A . 0 = 0 A variable AND’ed with 0 is always
equal to 0
• A + 1 = 1 A variable OR’ed with 1 is always
equal to 1
• Identity Law – A term OR´ed with a “0”
or AND´ed with a “1” will always equal that term
• A + 0 = A A variable OR’ed with 0 is always equal
to the variable
• A . 1 = A A variable AND’ed with 1 is always
equal to the variable
22
• Idempotent Law – An input that is AND´ed or OR´ed
with itself is equal to that input
• A + A = A A variable OR’ed with itself is always equal
to the variable
• A . A = A A variable AND’ed with itself is always
equal to the variable
• Complement Law – A term AND´ed with its
complement equals “0” and a term OR´ed with its
complement equals “1”
•
• A . A = 0 A variable AND’ed with its complement is
always equal to 0
• A + A = 1 A variable OR’ed with its complement is
always equal to 1
23
• Commutative Law – The order of application of
two separate terms is not important
•
• A . B = B . A The order in which two variables are
AND’ed makes no difference
• A + B = B + A The order in which two variables are
OR’ed makes no difference
•
• Double Negation Law – A term that is inverted
twice is equal to the original term
•
• (A’)’ = A A double complement of a variable is
always equal to the variable
24
• Distributive Law – This law permits the multiplying or
factoring out of an expression.
•
• A(B + C) = A.B + A.C (OR Distributive Law)
• A + (B.C) = (A + B).(A + C) (AND Distributive Law)
•
• Absorptive Law – This law enables a reduction in a
complicated expression to a simpler one by absorbing
like terms.
•
• A + (A.B) = A (OR Absorption Law)
• A(A + B) = A (AND Absorption Law)
25
• Associative Law – This law allows the removal of
brackets from an expression and regrouping of the
variables.
• A + (B + C) = (A + B) + C = A + B + C (OR
Associate Law)
• A(B.C) = (A.B)C = A . B . C (AND Associate Law)
• de Morgan´s Theorem – There are two “de
Morgan´s” rules or theorems,
(1) Two separate terms NOR´ed together is the same
as the two terms inverted (Complement) and AND´ed
for example: A+B = A . B
(2) Two separate terms NAND´ed together is the
same as the two terms inverted (Complement)
and OR´ed for example: A.B = A + B
26
Operator Precedence
27
The operator precedence for evaluating Boolean Expression
is
Parentheses
NOT
AND
OR
Examples
x y' + z
(x y + z)'
27
29
Boolean
Expression Description
Equivalent
Switching Circuit
Boolean Algebra
Law or Rule
A + 1 = 1 A in parallel with
closed = “CLOSED” Annulment
A + 0 = A A in parallel with
open = “A” Identity
A . 1 = A A in series with
closed = “A” Identity
A . 0 = 0 A in series with
open = “OPEN” Annulment
A + A = A A in parallel with
A = “A” Idempotent
A . A = A A in series with
A = “A” Idempotent
NOT A’ = A NOT NOT A
(double negative) = “A” Double Negation
A + A = 1 A in parallel with
NOT A = “CLOSED” Complement
A . A = 0 A in series with
NOT A = “OPEN” Complement
A+B = B+A A in parallel with B =
B in parallel with A Commutative
A.B = B.A A in series with B =
B in series with A Commutative
A+B = A.B invert and replace OR with AND de Morgan’s Theorem
A.B = A+B invert and replace AND with OR de Morgan’s Theorem
Report
Boolean Algebra Example No1
Construct a Truth Table for the logical functions at
points C, D and Q in the following circuit and identify
a single logic gate that can be used to replace the whole circuit.
33
38
Inputs Intermediates Output
C B A A.B.C B C B+C A.(B+C) Q
0 0 0 0 1 1 1 0 0
0 0 1 0 1 1 1 1 1
0 1 0 0 0 1 1 0 0
0 1 1 0 0 1 1 1 1
1 0 0 0 1 0 1 0 0
1 0 1 0 1 0 1 1 1
1 1 0 0 0 0 0 0 0
1 1 1 1 0 0 0 0 1
Report
39
Proof That
1. xy + x’z + yz = xy + x’z
2. (x+y)•(x’+z)•(y+z) = (x+y)•(x’+z) -- (dual)
Proof:
xy + x’z + yz = xy + x’z + (x+x’)yz
= xy + x’z + xyz + x’yz
= (xy + xyz) + (x’z + x’zy)
= xy + x’z
QED (2 true by duality).
39