boolean logic, logic gates, truth tablesjordan/teaching/elec1099/logicgatestruthtables… ·...

Post on 15-Mar-2018

226 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Boolean Logic, Logic Gates, TruthTablesJ. Dimitrov

jordan@dmu.ac.uk

Software Technology Research Laboratory (STRL)

De Montfort University

Leicester, UK.

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 1

Overview

Boolean logic (algebra)

Gates implementing boolean operators

Some expressions

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 2

Boolean logic

Named after the nineteenth-centurymathematician George Boole

Allows us to reason and draw conclusions bycalculating thruth values.

It models the world by assuming atomicsentences and assigning truth values to those.

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 3

Why logic?

Couldn’t we do without logic?

Example: If John loves Mary then he gives herflowers. John gives Mary flowers.What could we say about John and Mary?

Example: What is the opposite statement of “Ifit rains, I take an umbrella”?

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 4

Why logic?

John may not love Mary!

The opposite of “If it rains, I take an umbrella”is “It rains and I don’t have an umbrella”.

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 5

Basics

As we said, we’ll have a collection of atomicsentences.

They will model our world.

They will include statements like “John lovesMary”, “John gives Mary flowers”, “It rains” and“I have an umbrella”.

These statements will be represented byletters A,B,C, etc.

From the atomic statements we will buildcomplex statements such as “If John lovesMary then he gives her flowers”.

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 6

Basics

An atomic sentence

The World (Universe)

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 7

Basics

A set

D

C

B

A

An atomic sentence

The World (Universe)

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 8

Boolean opertations

NotInverts the truth value of the argument.

Denoted as A, Not(A),¬A.

A = true, iffA = false

AndLogical andDenoted as A.B,A And B,A ∧ B.A.B = true, iffA = true and B = true.

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 9

Boolean operations

OrLogical orDenoted as A + B,A Or B,A ∨ B.A + B = true, iffA = true or B = true.

ImplicationLogical implicationDenoted as A ⇒ B.A ⇒ B = true, iffA = true implies B = true.

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 10

Truth tables and gates

Thinking now about true =1 and false=0.

Not

A A

0 11 0

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 11

Truth tables and gates

And

A B A.B

0 0 00 1 01 0 01 1 1

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 12

Truth tables and gates

Or

A B A + B

0 0 00 1 11 0 11 1 1

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 13

Truth tables and gates

ImplicationA B A ⇒ B

0 0 10 1 11 0 01 1 1

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 14

More operations and gates

Some abreviations

is the same as

Nand, Nor, Xor, XNor, etc

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 15

Boolean algebra

A.A = 0

A + A = 1

A.1 = A

A.0 = 0

A.A = A

A + 1 = 1

A + 0 = A

A + A = A

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 16

Boolean algebra

A.B = B.A

A + B = B + A

A.B.C = (A.B).C = A.(B.C)

A + B + C = (A + B) + C = A + (B + C)

A.(B + C) = A.B + A.C= (A.B) + (A.C)

A + (B.C) = (A + B).(A + C) 6= A + (B.A) + C

A + B = A.B

A.B = A + B

A = A

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 17

De Morgan’s law

A + B = A.B

Why this will be the case?

A + B = A.B

A + B = A + B = A.B

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 18

Other forms of De Morgan’s law

A.B = A + B

A Xor B = A XNor B

J.Dimitorv, STRL, DMU, jordan@dmu.ac.uk – p. 19

top related