boolean algebra. binary logic and gates binary variables take on one of two values. logical...

29
Boolean Algebra

Upload: abel-todd

Post on 24-Dec-2015

224 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Boolean Algebra

Page 2: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Binary Logic and Gates

• Binary variables take on one of two values.• Logical operators operate on binary values and

binary variables.• Basic logical operators are the logic functions

AND, OR and NOT.• Logic gates implement logic functions.• Boolean Algebra: a useful mathematical system

for specifying and transforming logic functions.• We study Boolean algebra as a foundation for

designing and analyzing digital systems!

Page 3: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Binary Variables• Recall that the two binary values have

different names:– True/False– On/Off– Yes/No– 1/0

• We use 1 and 0 to denote the two values.• Variable identifier examples:

– A, B, y, z, or X1

Page 4: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Logical Operations• The three basic logical operations are:

– AND – OR– NOT

• AND is denoted by a dot (·). • OR is denoted by a plus (+).• NOT is denoted by an overbar ( ¯ ), a single

quote mark (') after, or (~) before the variable.

Page 5: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

• Examples:– is read “Y is equal to A AND B.”– is read “z is equal to x OR y.”– is read “X is equal to NOT A.”

Notation Examples

Note: The statement: 1 + 1 = 2 (read “one plus one equals two”)

is not the same as1 + 1 = 1 (read “1 or 1 equals 1”).

= BAY ×yxz +=

AX =

Page 6: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Operator Definitions

Operations are defined on the values "0" and "1" for each operator:

AND

0 · 0 = 00 · 1 = 01 · 0 = 01 · 1 = 1

OR

0 + 0 = 00 + 1 = 11 + 0 = 11 + 1 = 1

NOT

10=01=

Page 7: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

0110

XNOT

XZ=

Truth Tables• Tabular listing of the values of a function for all

possible combinations of values on its arguments• Example: Truth tables for the basic logic operations:

111001010000Z = X·YYX

AND ORX Y Z = X+Y0 0 00 1 11 0 11 1 1

Page 8: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Truth Tables – Cont’d

• Used to evaluate any logic function• Consider F(X, Y, Z) = X Y + Y Z

X Y Z X Y Y Y Z F = X Y + Y Z0 0 0 0 1 0 00 0 1 0 1 1 10 1 0 0 0 0 00 1 1 0 0 0 01 0 0 0 1 0 01 0 1 0 1 1 11 1 0 1 0 0 11 1 1 1 0 0 1

Page 9: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Logic Gate Symbols and Behavior• Logic gates have special symbols:

• And waveform behavior in time as follows:

X 0 0 1 1

Y 0 1 0 1

X · Y(AND) 0 0 0 1

X + Y(OR) 0 1 1 1

(NOT) X 1 1 0 0

OR gate

X

YZ = X + Y

X

YZ = X · Y

AND gate

X Z= X

NOT gate orinverter

Page 10: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Logic Diagrams and Expressions

• Boolean equations, truth tables and logic diagrams describe the same function!

• Truth tables are unique, but expressions and logic diagrams are not. This gives flexibility in implementing functions.

X

Y F

Z

Logic Diagram

Logic Equation

ZY X F +=

Truth Table

11 1 1

11 1 0

11 0 1

11 0 0

00 1 1

00 1 0

10 0 1

00 0 0

X Y Z Z Y X F ×+=

Page 11: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NAND Gate

11

X Y Z0 0 10 1 11 0 11 1 0

XY

Y X YXZ

Page 12: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NAND Gate as an Inverter Gate

12

X Z0 11 0

X XZ

XXX (Before Bubble)

Equivalent to Inverter

Page 13: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NAND Gate as an AND Gate

13

X Y Z0 0 00 1 01 0 01 1 1

XY

YX YXZ

YX

NAND Gate Inverter

Equivalent to AND Gate

Page 14: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NAND Gate as an OR Gate

14

X Y Z0 0 00 1 11 0 11 1 1

Equivalent to OR Gate

X

YYXY X Y XZ

X

NAND GateInverters

Y

Page 15: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NOR Gate

X Y Z0 0 10 1 01 0 01 1 0

XY

Y X Y XZ

15

Page 16: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NOR Gate as an Inverter Gate

X Z0 11 0

X XZ

XXX (Before Bubble)

Equivalent to Inverter

16

Page 17: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NOR Gate as an OR Gate

X Y Z0 0 00 1 11 0 11 1 1

XY

YX Y XZ

Y X

NOR Gate “Inverter”

Equivalent to OR Gate

17

Page 18: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

NOR Gate as an AND Gate

X Y Z0 0 00 1 01 0 01 1 1

Equivalent to AND Gate

X

YY XY X Y XZ

X

NOR Gate“Inverters”

Y

18

Page 19: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Boolean Algebra

Variable – a symbol used to represent a logical quantity.Complement – the inverse of a variable and is indicated by a bar over the variable.Literal – a variable or the complement of a variable.

Page 20: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

1.

3.

5.

7.

9.

11.

13.

15.

17.

Commutative

Associative

Distributive

DeMorgan’s

2.

4.

6.

8.

X . 1 X=

X . 0 0=

X . X X=

0=X . X

Boolean Algebra

10.

12.

14.

16.

X + Y Y + X=

(X + Y) Z+ X + (Y Z)+=X(Y + Z) XY XZ+=

X + Y X . Y=

XY YX=

(XY) Z X(Y Z)=

X + YZ (X + Y) (X + Z)=

X . Y X + Y=

X + 0 X=

+X 1 1=

X + X X=

1=X + X

X = X

Invented by George Boole in 1854 An algebraic structure defined by a set B = {0, 1}, together with two binary

operators (+ and ·) and a unary operator ( )

Idempotence

Complement

Involution

Identity element

Page 21: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Useful Theorems• Minimization

X Y + X Y = Y

• AbsorptionX + X Y = X

• SimplificationX + X Y = X + Y

• DeMorgan’s• X + Y = X · Y

Minimization (dual)(X+Y)(X+Y) = Y

Absorption (dual)X · (X + Y) = X

Simplification (dual)X · (X + Y) = X · Y

DeMorgan’s (dual) X · Y = X + Y

Page 22: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Some Properties of Boolean Algebra

Boolean Algebra is defined in general by a set B that can have more than two values

A two-valued Boolean algebra is also know as Switching Algebra. The Boolean set B is restricted to 0 and 1. Switching circuits can be represented by this algebra.

The dual of an algebraic expression is obtained by interchanging + and · and interchanging 0’s and 1’s.

The identities appear in dual pairs. When there is only one identity on a line the identity is self-dual, i. e., the dual expression = the original expression.

Sometimes, the dot symbol ‘’ (AND operator) is not written when the meaning is clear

Page 23: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Boolean Operator Precedence The order of evaluation is:

1. Parentheses2. NOT3. AND4. OR

Consequence: Parentheses appear around OR expressions Example: F = A(B + C)(C + D)

Page 24: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Reducing Boolean expression

Page 25: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Example 1

Page 26: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Boolean Algebraic Proof – Example 1

• A + A · B = A (Absorption Theorem)Proof Steps Justification A + A · B= A · 1 + A · B Identity element: A · 1 = A

= A · ( 1 + B) Distributive

= A · 1 1 + B = 1

= A Identity element

• Our primary reason for doing proofs is to learn:– Careful and efficient use of the identities and theorems of

Boolean algebra, and– How to choose the appropriate identity or theorem to apply

to make forward progress, irrespective of the application.

Page 27: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

• AB + AC + BC = AB + AC (Consensus Theorem)Proof Steps Justification= AB + AC + BC= AB + AC + 1 · BC Identity element= AB + AC + (A + A) · BC Complement= AB + AC + ABC + ABC Distributive= AB + ABC + AC + ACB Commutative= AB · 1 + ABC + AC · 1 + ACB Identity element= AB (1+C) + AC (1 + B) Distributive= AB . 1 + AC . 1 1+X = 1= AB + AC Identity element

Boolean Algebraic Proof – Example 2

Page 28: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Truth Table to Verify DeMorgan’s

X Y X·Y X+Y X Y X+Y X · Y X·Y X+Y

0 0 0 0 1 1 1 1 1 10 1 0 1 1 0 0 0 1 11 0 0 1 0 1 0 0 1 11 1 1 1 0 0 0 0 0 0

X + Y = X · Y X · Y = X + Y

• Generalized DeMorgan’s Theorem:X1 + X2 + … + Xn = X1 · X2 · … · Xn

X1 · X2 · … · Xn = X1 + X2 + … + Xn

Page 29: Boolean Algebra. Binary Logic and Gates Binary variables take on one of two values. Logical operators operate on binary values and binary variables. Basic

Simplification Using Boolean Algebra• AB+A(B+C)+B(B+C)

– (distributive law)• AB+AB+AC+BB+BC

– (rule 7; BB=B)• AB+AB+AC+B+BC

– (rule 5; AB+AB=AB)• AB+AC+B+BC

– (rule 10; B+BC=B)• AB+AC+B

– (rule 10; AB+B=B)• B+AC

A

B

C

B+AC

A

BC AB+A(B+C)+B(B+C)