boolean logic, logic gates, truth tablesjordan/teaching/elec1099/logicgatestruthtables… ·...
TRANSCRIPT
![Page 1: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/1.jpg)
Boolean Logic, Logic Gates, TruthTablesJ. Dimitrov
Software Technology Research Laboratory (STRL)
De Montfort University
Leicester, UK.
J.Dimitorv, STRL, DMU, [email protected] – p. 1
![Page 2: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/2.jpg)
Overview
Boolean logic (algebra)
Gates implementing boolean operators
Some expressions
J.Dimitorv, STRL, DMU, [email protected] – p. 2
![Page 3: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/3.jpg)
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, [email protected] – p. 3
![Page 4: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/4.jpg)
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, [email protected] – p. 4
![Page 5: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/5.jpg)
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, [email protected] – p. 5
![Page 6: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/6.jpg)
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, [email protected] – p. 6
![Page 8: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/8.jpg)
Basics
A set
D
C
B
A
An atomic sentence
The World (Universe)
J.Dimitorv, STRL, DMU, [email protected] – p. 8
![Page 9: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/9.jpg)
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, [email protected] – p. 9
![Page 10: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/10.jpg)
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, [email protected] – p. 10
![Page 11: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/11.jpg)
Truth tables and gates
Thinking now about true =1 and false=0.
Not
A A
0 11 0
J.Dimitorv, STRL, DMU, [email protected] – p. 11
![Page 12: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/12.jpg)
Truth tables and gates
And
A B A.B
0 0 00 1 01 0 01 1 1
J.Dimitorv, STRL, DMU, [email protected] – p. 12
![Page 13: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/13.jpg)
Truth tables and gates
Or
A B A + B
0 0 00 1 11 0 11 1 1
J.Dimitorv, STRL, DMU, [email protected] – p. 13
![Page 14: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/14.jpg)
Truth tables and gates
ImplicationA B A ⇒ B
0 0 10 1 11 0 01 1 1
J.Dimitorv, STRL, DMU, [email protected] – p. 14
![Page 15: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/15.jpg)
More operations and gates
Some abreviations
is the same as
Nand, Nor, Xor, XNor, etc
J.Dimitorv, STRL, DMU, [email protected] – p. 15
![Page 16: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/16.jpg)
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, [email protected] – p. 16
![Page 17: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/17.jpg)
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, [email protected] – p. 17
![Page 18: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/18.jpg)
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, [email protected] – p. 18
![Page 19: Boolean Logic, Logic Gates, Truth Tablesjordan/teaching/elec1099/LogicGatesTruthTables… · Boolean Logic, Logic Gates, Truth Tables J. Dimitrov jordan@dmu.ac.uk Software Technology](https://reader035.vdocument.in/reader035/viewer/2022062907/5aa986b57f8b9a7c188cf518/html5/thumbnails/19.jpg)
Other forms of De Morgan’s law
A.B = A + B
A Xor B = A XNor B
J.Dimitorv, STRL, DMU, [email protected] – p. 19