Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

33
Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002

Transcript of Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Page 1: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Lecture 2 – Boolean Algebra

Lecturer: Amy ChingDate: 21st Oct 2002

Page 2: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Binary Systems Computer hardware works with binary

numbers, but binary arithmetic is much older than computers Ancient Chinese Civilisation (3000 BC) Ancient Greek Civilisation (1000 BC) Boolean Algebra (1850)

Page 3: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Propositional Logic The Ancient Greek philosophers created a

system to formalise arguments called propositional logic.

A proposition is a statement that could be TRUE or FALSE

Propositions could be compounded into by means of the operators AND, OR and NOT

Page 4: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Propositional Calculus Example

Propositions, that may be TRUE or FALSE:

it is raining

the weather forecast is bad

A combined proposition:

it is raining OR the weather forecast is bad

Page 5: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Propositional Calculus Example

We can equate propositions, for example by writing:I will take an umbrella = it is raining OR the weatherforecast is bad

or equivalently we can write:If it is raining OR the weather forecast is badThen I will take an umbrella

ORRain Bad Weather Forecast Take Umbrella

Page 6: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Diagrammatic representation We can think of the umbrella proposition as

a result that we calculate from the weather forecast or the fact that it is raining

Rain

Bad Weather Forecast

OR Take Umbrella

Page 7: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Truth Tables Since propositions can only take two

values, we can express all possible outcomes of the umbrella proposition by a table:

Raining Bad Weather Umbrella

False False False

False True True

True True True

True False True

Page 8: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Boolean Algebra Propositional logic is too cumbersome to

express arguments of any complexity. An equivalent, more tractable system of

logic was introduced by the English mathematician Boole in 1850.

Page 9: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Boolean Algebra A Boolean variable has only one of two

values: true or false (1 or 0), called logic values. A Boolean variable can be a function of other

Boolean variables, i.e. Z = F(A, B, C, D…). We can also express the function in terms of a

Truth Table A Truth Table is a tabulated list contains a clear

relationship between all possible combination of input variables and the resultant operation.

Page 10: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Fundamental OperatorsAnd OperatorThree fundamental operators AND, OR and NOT.

AND OperatorZ = A B

The AND operation is represented by the symbol “”. The truth table or logic table of the AND operation is as follows:

A B Z = A B

0 0 0

0 1 0

1 0 0

1 1 1

Page 11: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Fundamental Operators –OR OperatorOR Operator

Z = A + B

The OR operation is represented by the “+” symbol. Note that the OR operation is not related to addition in ordinary arithmetic. The truth table for OR is as follows:

A B Z = A B

0 0 0

0 1 1

1 0 1

1 1 1

Page 12: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Fundamental Operators –NOT OperatorNOT Operator

or Z = A’ The NOT operation is designated by an overline or an

hyphen. In words, the above expression is “Z” is equal to a

NOT”. The truth table for the NOT operation is as follows:

The NOT operation is a complement operation.

AZ

A

0 1

1 0

AZ

Page 13: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Fundamentals of Boolean Algebra

The truth values are replaced by 1 and 0: 1 = TRUE 0 = FALSE Operators are replaced by symbols ' = NOT + = OR • = AND

Page 14: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Precedence Further simplification is introduced by introducing a

precedence for the evaluation of the operators. (The highest precedence operator is evaluated first.)

Operator Symbol Precedence

NOT ' Highest

AND • Middle

OR + Lowest

Page 15: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

All outcomes can be written as:

A B Z = A B

0 0 0

0 1 0

1 0 0

1 1 1

A B Z = A B

0 0 0

0 1 1

1 0 1

1 1 1

A

0 1

1 0

AND Operator (•) OR Operator (+) NOT

'

Page 16: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Boolean Algebra Laws1) Communicative laws 2) Associative laws

A + B = B + A A+(B+C) = (A+B)+C AB = BA (AB)C = A(BC)3) Distributive laws 4) Absorption Law

A (B+C) = (A B) + (A C) A (A+B) = A +(A B)5) Complement Law

A + = 1A = 0

Other useful relationship:1) A 1 = A 2) A 0 = 0 3) A + 1 = 1 4) A + 0 = A5) A + A = A 6) A A = A

A

A

Page 17: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

DeMorgan’s Theorem1) 2)

Both forms of the DeMorgan’s Theorem have complement of an entire expression, and the effect of this complementing is to interchange each “+” to a “” and each “” to a “+” and to complement each variable

Expression 1) is also described as inputs A and B with a NAND operator

Expression 2) is also described as inputs A and B with a NOR operator

BABA )(

BABA )(

Page 18: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Simplification of Boolean Equation Using DeMorgan’s Theorem

Simplify Y = (A+B) (A+C)Y = (A+B) (A+C) = A A + A C + B A + B C = A + A C + A B + B C = A (1+C+B) + B C – Redundance Law = A + B C

Page 19: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Sum of Product (SOP) and Product of Sum (POS) Product term - is a single variable of the logic

product of several variables. The variables may or may not be complemented. e.g. XYZ, Y

Sum term - is a single variable or the sum of several variables. The variable may or may not be complemented e.g. X+Y,

Sum of products expression - is a product term of several product terms logically added together e.g.

Product of sums expression - is a sum term or several sum terms logically multiplied together e.g.

X

X

XYZXYXYX ,,

ZYXX )(,

Page 20: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Conversion of a truth table into SOP and POS

X Y Z ProductTerms

SumTerms

0 0 1

0 1 0

1 0 1

1 1 1

Sum of product solution Product of sum solution

YX

YXYX

XY

YX

YX YX YX

XYYXYXZ

)( YXZ

Page 21: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Derivation of SOP and POSSum of Products expression (Minterm Form)1) From a truth table2) The product terms from each row in which the

output is a “1” are collected3) The desired expression is the sum of these

products e.g.

Product of Sums expression (Maxterm Form)1) Form a truth table2) Construct a column to contain the sum terms3) The required expression is the product of sums

terms from the row in which the output is “0” e.g.

XYYXYXZ

)( YXZ

Page 22: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Karnaugh Map (K-Map) The Karnaugh map provides a formal

systematic approach to the problem of minimisation of logic functions. e.g.

In the Karnaugh map, every possible combination of the binary input variables is represented on the map by a square ( or cell).

For N input variables, we have 2n square.

BABBA

Page 23: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Layout of Karnaugh Map

XY

X X

Y

Y

XY

Z

0 1

0

1

00

1

0

101101

AB

CD00 101101

00

01

11

10

Page 24: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Use of K-Map In this way, by inspection, it is obvious that

terms can be combined and simplified using the theorem. e.g.

To plot the SOP function on Karnaugh map, a “1” is entered in each square corresponding to a product term in the function.

BABBA

0A

B1

0

1

Y=AB

1

Page 25: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Use of K-Map To use the map to form the POS function, a “0”

is entered in each cell corresponding to each sum term in the function. Result of simplification should then be in POS form.

00XY

Z01

0

1

A=(X+Y+Z).(X+Y+Z)

0

11 10

0

Page 26: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Representation of Karnaugh Map Truth Table vs Karnaugh Map

A B Z = A B

0 0 0

0 1 1

1 0 1

1 1 1

0A

B1

0

1

1

11

0

Truth Table Karnaugh Map

Page 27: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Use of K-Map There is a correspondence between top and

bottom rows, and between extreme left and right-hand columns.

00XY

Z01

0

1

A=YZ

1

11 10

1

Page 28: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Simplification using a K-Map Simplify

Solution

CACABCABAY

00AB

C01

0

1

1

11 10

1 1

1 1

CACACBY

Page 29: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Example 1

Page 30: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Example 2

Page 31: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Example 3

Page 32: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Example 4

Page 33: Lecture 2 – Boolean Algebra Lecturer: Amy Ching Date: 21 st Oct 2002.

Example 5