SlideShare a Scribd company logo
Boolean Logic
George Boole
In1854, George Boole published
“An investigation into the Laws
of Thought, on which are
founded the Mathematical
Theories of Logic and
Probabilities.”
Boole outlined a system of logic
and a corresponding algebraic
language dealing with true and
false values.
Boolean Logic
Boolean logic is a form of
mathematics in which the
only values used are true
and false.
Boolean logic is the basis
of all modern computing.
There are three basic
operations in Boolean logic
– AND, OR, and NOT.
The AND Operation
AND
b
T F
a
T T F
F F F
The AND operation is a binary
operation, meaning that it needs
two operands.
c = a AND b
Both a and b must be true for the
result to be true.
The OR Operation
The OR operation is also a
binary operation with two
operands.
c = a OR b
If either a OR b is true, then
the result is true.
OR
b
T F
a
T T T
F T F
The NOT Operation
The NOT operation is a unary
operation with only one operand.
c = NOT (a)
It simply reverses the true or
false value of the operand.
NOT
a
T F
F T
Let’s use Boolean logic to
examine class.
 Please stand up if you are:
◦ girl
◦ AND black hair
◦ AND left handed
 Please stand up if you are:
◦ girl
◦ OR black hair
◦ OR left handed
 And NOT
 How has the group changed depending on the logical
operator used.
Logical Conditions
Logical comparisons that are
either true or false are most
often used as the basis for
the true and false values in
Boolean logic.
They are often used for simple
conditions in branching and
looping instructions.
If (hours > 40)
pay overtime
If (age < 12)
stay in the back seat
While (count  10)
print count
increment count
Nesting
 When more than one element is in parentheses, the sequence is
left to right. This is called "nesting.“
◦ (foxes OR rabbits) AND pest control
◦ foxes OR rabbits AND pest control
◦ (animal pests OR pest animals) NOT rabbits
Order of precedence of Boolean
operators
 The order of operations is: AND, NOT, OR, XOR
 Parentheses are used to override priority.
 Expressions in parentheses are processed first.
 Parentheses are used to organize the sequence and
groups of concepts.
Write out logic statements using
Boolean operators for these.
• You have a buzzer in your car that sounds when your
keys are in the ignition and the door is open.
• You have a fire alarm installed in your house. This
alarm will sound if it senses heat or smoke.
• There is an election coming up. People are allowed to
vote if they are a citizen and they are 18.
• To complete an assignment the students must do a
presentation or write an essay.
Basis for digital computers.
 The true-false nature of Boolean
logic makes it compatible with
binary logic used in digital
computers.
 Electronic circuits can produce
Boolean logic operations.
 Circuits are called gates.
◦ NOT
◦ AND
◦ OR
AND gate
 The AND gate has the following symbol and
logic table.
 Two or more input bits produce one output bit.
 Both inputs must be true (1) for the output to be
true.
 Otherwise the output is false (0).
A B Q
0 0 0
0 1 0
1 0 0
1 1 1
OR gate
 The OR gate has the following symbol and logic table.
 Two or more input bits produce one output bit.
 Either inputs must be true (1) for the output to be true.
A B Q
0 0 0
0 1 1
1 0 1
1 1 1
NOT gate
 The simplest possible gate is called an "inverter," or a NOT gate.
 One bit as input produces its opposite as output.
 The symbol for a NOT gate in circuit diagrams is shown below.
 The logic table for the NOT gate shows input and output.
A Q
0 1
1 0
Combine gates.
 Gates can be combined.
 The output of one gate can become the input of another.
 Try to determine the logic table for this circuit.
What happens when you add a
NOT to an AND gate?
Not
A B Q
0 0 0
0 1 0
1 0 0
1 1 1
A B Q
0 0 1
0 1 1
1 0 1
1 1 0
Can you make an AND gate from
an NAND?
A B Q
0 0 0
0 1 0
1 0 0
1 1 1
“Exclusive” gates
 Exclusively OR gate are true if either input is true but
not both.
A B Q
0 0 0
0 1 1
1 0 1
1 1 0
A B Q
0 0 1
0 1 0
1 0 0
1 1 1
Truth Tables
xy = x AND y = x * y x + y = x OR y x bar = NOT x
AND is true only if OR is true if either NOT inverts the bit
both inputs are true inputs are true We will denote x bar as ~X
NOR is NOT of OR NAND is NOT of AND XOR is true if both inputs
differ
Logic Gates
Here we see the logic gates
that represent the boolean
operations previously
discussed
XOR looks like OR
but with the added
curved line
We typically represent NOR and NAND by the two
on the left, but the two on the right are also correct
How do we use gates to add two
binary numbers?
 Binary numbers are either 1 or 0, either on or off.
 Have two outputs.
 Need a gate to produce each output.
0 0 1 1
+ 0 + 1 + 0 + 1
00 01 01 10
A B Q CO
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
An Example: Half Adder
• There are 4 possibilities
when adding 2 bits
together:
0 + 0 0 + 1 1 + 0 1 + 1
• In the first case, we have a sum
of 0 and a carry of 0
• In the second and third cases,
we have a sum of 1 and a carry
of 0
• In the last case, we have a sum
of 0 and a carry of 1
• These patterns are
demonstrated in the truth table
above to the right
• Notice that sum computes
the same as XOR and carry
computes the same as AND
• We build an Adder using just
one XOR and one AND gate
The truth table for Sum and Carry
and a circuit to compute these
Full Adder
 The half adder really only does half the work
◦ adds 2 bits, but only 2 bits
 If we want to add 2 n-bit
numbers, we need to also
include the carry in from the
previous half adder
◦ So, our circuit becomes more
complicated
 In adding 3 bits (one bit from
x, one bit from y, and the
carry in from the previous
addition), we have 8
possibilities
◦ The sum will either be 0 or 1 and the
carry out will either be 0 or 1
◦ The truth table is given to the right
Building a Full Adder Circuit
 The sum is 1 only if one of x, y
and carry in are 1, or if all three
are 1, the sum is 0 otherwise
 The carry out is 1 if two or three
of x, y and carry in were 1, 0
otherwise
◦ The circuit to the right captures this
by using 2 XOR gates for Sum and 2
AND gates and an OR gate for Carry
Out

More Related Content

What's hot

Division algorithm
Division algorithmDivision algorithm
Division algorithm
SnehalataAgasti
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
Chamodi Adikaram
 
Algorithm
AlgorithmAlgorithm
Algorithm
IHTISHAM UL HAQ
 
Presentation On Logic Gate
Presentation On Logic Gate Presentation On Logic Gate
Presentation On Logic Gate
Nazrul Islam
 
Nand and nor as a universal gates
Nand and nor as a universal gatesNand and nor as a universal gates
Nand and nor as a universal gates
Kaushal Shah
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
Sachin Goyani
 
Number Systems
Number SystemsNumber Systems
Number Systems
Jubayer Alam Shoikat
 
Digital logic gates and Boolean algebra
Digital logic gates and Boolean algebraDigital logic gates and Boolean algebra
Digital logic gates and Boolean algebra
SARITHA REDDY
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
vishal choudhary
 
Arithmetic & Logic Unit
Arithmetic & Logic UnitArithmetic & Logic Unit
Arithmetic & Logic Unit
ramya marichamy
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
Meenakshi Paul
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
Nallapati Anindra
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
Shiraz316
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
Vaagdevi College of Engineering
 
ALU
ALUALU
Stack organization
Stack organizationStack organization
Stack organization
chauhankapil
 

What's hot (20)

Binary arithmetic
Binary arithmeticBinary arithmetic
Binary arithmetic
 
Division algorithm
Division algorithmDivision algorithm
Division algorithm
 
Number system conversion
Number system conversionNumber system conversion
Number system conversion
 
Von Neumann Architecture
Von Neumann ArchitectureVon Neumann Architecture
Von Neumann Architecture
 
Algorithm
AlgorithmAlgorithm
Algorithm
 
Presentation On Logic Gate
Presentation On Logic Gate Presentation On Logic Gate
Presentation On Logic Gate
 
Nand and nor as a universal gates
Nand and nor as a universal gatesNand and nor as a universal gates
Nand and nor as a universal gates
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
Number Systems
Number SystemsNumber Systems
Number Systems
 
Digital logic gates and Boolean algebra
Digital logic gates and Boolean algebraDigital logic gates and Boolean algebra
Digital logic gates and Boolean algebra
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
Arithmetic & Logic Unit
Arithmetic & Logic UnitArithmetic & Logic Unit
Arithmetic & Logic Unit
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
digital logic design number system
digital logic design number systemdigital logic design number system
digital logic design number system
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
ALU
ALUALU
ALU
 
Stack organization
Stack organizationStack organization
Stack organization
 

Viewers also liked

Boolean logic
Boolean logicBoolean logic
Boolean logicnandolea
 
Boolean Logic: how to talk to search engines in their own language
Boolean Logic: how to talk to search engines in their own languageBoolean Logic: how to talk to search engines in their own language
Boolean Logic: how to talk to search engines in their own language
Boxford Library
 
Boolean Logic Searching: A Primer
Boolean Logic Searching: A PrimerBoolean Logic Searching: A Primer
Boolean Logic Searching: A Primercswetzel
 
Apologetics 1 Lesson 6 Tools of Logic
Apologetics 1 Lesson 6 Tools of LogicApologetics 1 Lesson 6 Tools of Logic
Apologetics 1 Lesson 6 Tools of Logic
Third Column Ministries
 
Boolean Logic
Boolean LogicBoolean Logic
Boolean Logicnandolea
 
MLA International Bibliography: Finding Full Text
MLA International Bibliography: Finding Full TextMLA International Bibliography: Finding Full Text
MLA International Bibliography: Finding Full Text
Forsyth Library
 
Boolean Logic
Boolean LogicBoolean Logic
Basic+machine+organization
Basic+machine+organizationBasic+machine+organization
Basic+machine+organization
Bilal Maqbool ツ
 
Complement
ComplementComplement
Complement
Bilal Maqbool ツ
 
Dld lecture module 05
Dld lecture module 05Dld lecture module 05
Dld lecture module 05
Bilal Maqbool ツ
 
English 01 application
English 01 applicationEnglish 01 application
English 01 application
Bilal Maqbool ツ
 
Chapter10
Chapter10Chapter10
Dld lecture module 03
Dld lecture module 03Dld lecture module 03
Dld lecture module 03
Bilal Maqbool ツ
 
Dld lecture module 02
Dld lecture module 02Dld lecture module 02
Dld lecture module 02
Bilal Maqbool ツ
 
Number+system (1)
Number+system (1)Number+system (1)
Number+system (1)
Bilal Maqbool ツ
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
Bilal Maqbool ツ
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
Bilal Maqbool ツ
 

Viewers also liked (20)

Ch 5 boolean logic
Ch 5 boolean logicCh 5 boolean logic
Ch 5 boolean logic
 
Boolean Logic
Boolean LogicBoolean Logic
Boolean Logic
 
Boolean logic
Boolean logicBoolean logic
Boolean logic
 
Boolean Logic: how to talk to search engines in their own language
Boolean Logic: how to talk to search engines in their own languageBoolean Logic: how to talk to search engines in their own language
Boolean Logic: how to talk to search engines in their own language
 
Boolean Logic Searching: A Primer
Boolean Logic Searching: A PrimerBoolean Logic Searching: A Primer
Boolean Logic Searching: A Primer
 
Apologetics 1 Lesson 6 Tools of Logic
Apologetics 1 Lesson 6 Tools of LogicApologetics 1 Lesson 6 Tools of Logic
Apologetics 1 Lesson 6 Tools of Logic
 
Boolean Logic
Boolean LogicBoolean Logic
Boolean Logic
 
MLA International Bibliography: Finding Full Text
MLA International Bibliography: Finding Full TextMLA International Bibliography: Finding Full Text
MLA International Bibliography: Finding Full Text
 
Boolean logic presentation
Boolean logic presentationBoolean logic presentation
Boolean logic presentation
 
Boolean Logic
Boolean LogicBoolean Logic
Boolean Logic
 
Basic+machine+organization
Basic+machine+organizationBasic+machine+organization
Basic+machine+organization
 
Complement
ComplementComplement
Complement
 
Dld lecture module 05
Dld lecture module 05Dld lecture module 05
Dld lecture module 05
 
English 01 application
English 01 applicationEnglish 01 application
English 01 application
 
Chapter10
Chapter10Chapter10
Chapter10
 
Dld lecture module 03
Dld lecture module 03Dld lecture module 03
Dld lecture module 03
 
Dld lecture module 02
Dld lecture module 02Dld lecture module 02
Dld lecture module 02
 
Number+system (1)
Number+system (1)Number+system (1)
Number+system (1)
 
Graphical programming
Graphical programmingGraphical programming
Graphical programming
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 

Similar to Boolean+logic

LOGIC GATES WEEK 5.pptx
LOGIC GATES WEEK 5.pptxLOGIC GATES WEEK 5.pptx
LOGIC GATES WEEK 5.pptx
AllanGuevarra1
 
Week4_BooleanAlgebra.pptx
Week4_BooleanAlgebra.pptxWeek4_BooleanAlgebra.pptx
Week4_BooleanAlgebra.pptx
AbubakrZahid1
 
Boolean Logic.pptx
Boolean Logic.pptxBoolean Logic.pptx
Boolean Logic.pptx
akshat205573
 
Boolean Algebra.pptx
 Boolean Algebra.pptx Boolean Algebra.pptx
Boolean Algebra.pptx
ASHISHKUMAR15680
 
De Mornan Theory, Boolean Algebra, 7 logical get, truth table,
De Mornan Theory, Boolean Algebra, 7 logical get, truth table,  De Mornan Theory, Boolean Algebra, 7 logical get, truth table,
De Mornan Theory, Boolean Algebra, 7 logical get, truth table,
DharmaKumariBhandari
 
BOOLEAN ALGEBRA & LOGIC GATES.ppt
BOOLEAN ALGEBRA & LOGIC GATES.pptBOOLEAN ALGEBRA & LOGIC GATES.ppt
BOOLEAN ALGEBRA & LOGIC GATES.ppt
dhanamalathieee
 
Chapter 2 Boolean Algebra.pptx
Chapter 2 Boolean Algebra.pptxChapter 2 Boolean Algebra.pptx
Chapter 2 Boolean Algebra.pptx
HazardRhenz1
 
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational CircuitsCOMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
Vanitha Chandru
 
Introduction to Boolean Algebra
Introduction to Boolean AlgebraIntroduction to Boolean Algebra
Introduction to Boolean Algebra
blaircomp2003
 
boolean algrebra and logic gates in short
boolean algrebra and logic gates in shortboolean algrebra and logic gates in short
boolean algrebra and logic gates in short
Rojin Khadka
 
Logic Gates.pptx
Logic Gates.pptxLogic Gates.pptx
Logic Gates.pptx
DanicaHeusdens
 
2nd PUC computer science chapter 2 boolean algebra 1
2nd PUC computer science chapter 2  boolean algebra 12nd PUC computer science chapter 2  boolean algebra 1
2nd PUC computer science chapter 2 boolean algebra 1
Aahwini Esware gowda
 
L1 - Logic Gate & Truth Tables - student.pdf
L1 - Logic Gate & Truth Tables - student.pdfL1 - Logic Gate & Truth Tables - student.pdf
L1 - Logic Gate & Truth Tables - student.pdf
lcabey
 
Ass.(2)applications of logic u.s d.m
Ass.(2)applications of logic u.s d.mAss.(2)applications of logic u.s d.m
Ass.(2)applications of logic u.s d.m
Syed Umair
 
boolean-logic.pptx
boolean-logic.pptxboolean-logic.pptx
boolean-logic.pptx
KrishnaveniManickam3
 
Logic gates ,flip flop ,registers and
Logic gates ,flip flop ,registers andLogic gates ,flip flop ,registers and
Logic gates ,flip flop ,registers and
MuruganandhanD
 
Logic gates
Logic gatesLogic gates
Logic gates
dawood0317
 

Similar to Boolean+logic (20)

LOGIC GATES WEEK 5.pptx
LOGIC GATES WEEK 5.pptxLOGIC GATES WEEK 5.pptx
LOGIC GATES WEEK 5.pptx
 
Week4_BooleanAlgebra.pptx
Week4_BooleanAlgebra.pptxWeek4_BooleanAlgebra.pptx
Week4_BooleanAlgebra.pptx
 
Boolean Logic.pptx
Boolean Logic.pptxBoolean Logic.pptx
Boolean Logic.pptx
 
Boolean Algebra.pptx
 Boolean Algebra.pptx Boolean Algebra.pptx
Boolean Algebra.pptx
 
De Mornan Theory, Boolean Algebra, 7 logical get, truth table,
De Mornan Theory, Boolean Algebra, 7 logical get, truth table,  De Mornan Theory, Boolean Algebra, 7 logical get, truth table,
De Mornan Theory, Boolean Algebra, 7 logical get, truth table,
 
BOOLEAN ALGEBRA & LOGIC GATES.ppt
BOOLEAN ALGEBRA & LOGIC GATES.pptBOOLEAN ALGEBRA & LOGIC GATES.ppt
BOOLEAN ALGEBRA & LOGIC GATES.ppt
 
Chapter 2 Boolean Algebra.pptx
Chapter 2 Boolean Algebra.pptxChapter 2 Boolean Algebra.pptx
Chapter 2 Boolean Algebra.pptx
 
9. logic gates._rr
9. logic gates._rr9. logic gates._rr
9. logic gates._rr
 
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational CircuitsCOMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
COMPUTER ORGANIZATION - Logic gates, Boolean Algebra, Combinational Circuits
 
Introduction to Boolean Algebra
Introduction to Boolean AlgebraIntroduction to Boolean Algebra
Introduction to Boolean Algebra
 
boolean algrebra and logic gates in short
boolean algrebra and logic gates in shortboolean algrebra and logic gates in short
boolean algrebra and logic gates in short
 
Logic Gates.pptx
Logic Gates.pptxLogic Gates.pptx
Logic Gates.pptx
 
2nd PUC computer science chapter 2 boolean algebra 1
2nd PUC computer science chapter 2  boolean algebra 12nd PUC computer science chapter 2  boolean algebra 1
2nd PUC computer science chapter 2 boolean algebra 1
 
L1 - Logic Gate & Truth Tables - student.pdf
L1 - Logic Gate & Truth Tables - student.pdfL1 - Logic Gate & Truth Tables - student.pdf
L1 - Logic Gate & Truth Tables - student.pdf
 
Ass.(2)applications of logic u.s d.m
Ass.(2)applications of logic u.s d.mAss.(2)applications of logic u.s d.m
Ass.(2)applications of logic u.s d.m
 
boolean-logic.pptx
boolean-logic.pptxboolean-logic.pptx
boolean-logic.pptx
 
Logical Gates
Logical GatesLogical Gates
Logical Gates
 
Logic Gates
Logic GatesLogic Gates
Logic Gates
 
Logic gates ,flip flop ,registers and
Logic gates ,flip flop ,registers andLogic gates ,flip flop ,registers and
Logic gates ,flip flop ,registers and
 
Logic gates
Logic gatesLogic gates
Logic gates
 

More from Bilal Maqbool ツ

Dld lecture module 01
Dld lecture module 01Dld lecture module 01
Dld lecture module 01
Bilal Maqbool ツ
 
Uncdtalk
UncdtalkUncdtalk
Dld lecture module 06
Dld lecture module 06Dld lecture module 06
Dld lecture module 06
Bilal Maqbool ツ
 
Dld lecture module 04 01
Dld lecture module 04  01Dld lecture module 04  01
Dld lecture module 04 01
Bilal Maqbool ツ
 
Lecture 3 report writtng
Lecture 3 report writtngLecture 3 report writtng
Lecture 3 report writtng
Bilal Maqbool ツ
 
Lecture 2
Lecture 2Lecture 2
Lecture 1 report writing
Lecture 1 report writingLecture 1 report writing
Lecture 1 report writing
Bilal Maqbool ツ
 
Bill gates
Bill gatesBill gates
Bill gates
Bilal Maqbool ツ
 
Programming assignment 02 (bilal maqbool 10) 2011
Programming assignment 02    (bilal maqbool 10) 2011Programming assignment 02    (bilal maqbool 10) 2011
Programming assignment 02 (bilal maqbool 10) 2011
Bilal Maqbool ツ
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
Bilal Maqbool ツ
 
Internet presentation
Internet presentationInternet presentation
Internet presentation
Bilal Maqbool ツ
 
Presentation internet programming report
Presentation internet programming reportPresentation internet programming report
Presentation internet programming report
Bilal Maqbool ツ
 
Magnetic storage devices
Magnetic storage devicesMagnetic storage devices
Magnetic storage devices
Bilal Maqbool ツ
 
How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...
Bilal Maqbool ツ
 
Math assignment Program
Math assignment ProgramMath assignment Program
Math assignment Program
Bilal Maqbool ツ
 
Final of sentences PPT
Final of sentences PPTFinal of sentences PPT
Final of sentences PPT
Bilal Maqbool ツ
 
Advantages and disadvantages of LCD
Advantages and disadvantages of LCDAdvantages and disadvantages of LCD
Advantages and disadvantages of LCD
Bilal Maqbool ツ
 
A history of windows
A history of windowsA history of windows
A history of windows
Bilal Maqbool ツ
 

More from Bilal Maqbool ツ (20)

Dld lecture module 01
Dld lecture module 01Dld lecture module 01
Dld lecture module 01
 
Uncdtalk
UncdtalkUncdtalk
Uncdtalk
 
Okkkkk
OkkkkkOkkkkk
Okkkkk
 
Good
GoodGood
Good
 
Dld lecture module 06
Dld lecture module 06Dld lecture module 06
Dld lecture module 06
 
Dld lecture module 04 01
Dld lecture module 04  01Dld lecture module 04  01
Dld lecture module 04 01
 
Lecture 3 report writtng
Lecture 3 report writtngLecture 3 report writtng
Lecture 3 report writtng
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
Lecture 1 report writing
Lecture 1 report writingLecture 1 report writing
Lecture 1 report writing
 
Bill gates
Bill gatesBill gates
Bill gates
 
Programming assignment 02 (bilal maqbool 10) 2011
Programming assignment 02    (bilal maqbool 10) 2011Programming assignment 02    (bilal maqbool 10) 2011
Programming assignment 02 (bilal maqbool 10) 2011
 
Programming assignment 30 12-11
Programming assignment 30 12-11Programming assignment 30 12-11
Programming assignment 30 12-11
 
Internet presentation
Internet presentationInternet presentation
Internet presentation
 
Presentation internet programming report
Presentation internet programming reportPresentation internet programming report
Presentation internet programming report
 
Magnetic storage devices
Magnetic storage devicesMagnetic storage devices
Magnetic storage devices
 
How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...How internet technology be used to spread scientific awareness among pakistan...
How internet technology be used to spread scientific awareness among pakistan...
 
Math assignment Program
Math assignment ProgramMath assignment Program
Math assignment Program
 
Final of sentences PPT
Final of sentences PPTFinal of sentences PPT
Final of sentences PPT
 
Advantages and disadvantages of LCD
Advantages and disadvantages of LCDAdvantages and disadvantages of LCD
Advantages and disadvantages of LCD
 
A history of windows
A history of windowsA history of windows
A history of windows
 

Recently uploaded

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
Peter Windle
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 

Recently uploaded (20)

The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Embracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic ImperativeEmbracing GenAI - A Strategic Imperative
Embracing GenAI - A Strategic Imperative
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 

Boolean+logic

  • 2. George Boole In1854, George Boole published “An investigation into the Laws of Thought, on which are founded the Mathematical Theories of Logic and Probabilities.” Boole outlined a system of logic and a corresponding algebraic language dealing with true and false values.
  • 3. Boolean Logic Boolean logic is a form of mathematics in which the only values used are true and false. Boolean logic is the basis of all modern computing. There are three basic operations in Boolean logic – AND, OR, and NOT.
  • 4. The AND Operation AND b T F a T T F F F F The AND operation is a binary operation, meaning that it needs two operands. c = a AND b Both a and b must be true for the result to be true.
  • 5. The OR Operation The OR operation is also a binary operation with two operands. c = a OR b If either a OR b is true, then the result is true. OR b T F a T T T F T F
  • 6. The NOT Operation The NOT operation is a unary operation with only one operand. c = NOT (a) It simply reverses the true or false value of the operand. NOT a T F F T
  • 7. Let’s use Boolean logic to examine class.  Please stand up if you are: ◦ girl ◦ AND black hair ◦ AND left handed  Please stand up if you are: ◦ girl ◦ OR black hair ◦ OR left handed  And NOT  How has the group changed depending on the logical operator used.
  • 8. Logical Conditions Logical comparisons that are either true or false are most often used as the basis for the true and false values in Boolean logic. They are often used for simple conditions in branching and looping instructions. If (hours > 40) pay overtime If (age < 12) stay in the back seat While (count  10) print count increment count
  • 9. Nesting  When more than one element is in parentheses, the sequence is left to right. This is called "nesting.“ ◦ (foxes OR rabbits) AND pest control ◦ foxes OR rabbits AND pest control ◦ (animal pests OR pest animals) NOT rabbits
  • 10. Order of precedence of Boolean operators  The order of operations is: AND, NOT, OR, XOR  Parentheses are used to override priority.  Expressions in parentheses are processed first.  Parentheses are used to organize the sequence and groups of concepts.
  • 11. Write out logic statements using Boolean operators for these. • You have a buzzer in your car that sounds when your keys are in the ignition and the door is open. • You have a fire alarm installed in your house. This alarm will sound if it senses heat or smoke. • There is an election coming up. People are allowed to vote if they are a citizen and they are 18. • To complete an assignment the students must do a presentation or write an essay.
  • 12. Basis for digital computers.  The true-false nature of Boolean logic makes it compatible with binary logic used in digital computers.  Electronic circuits can produce Boolean logic operations.  Circuits are called gates. ◦ NOT ◦ AND ◦ OR
  • 13. AND gate  The AND gate has the following symbol and logic table.  Two or more input bits produce one output bit.  Both inputs must be true (1) for the output to be true.  Otherwise the output is false (0). A B Q 0 0 0 0 1 0 1 0 0 1 1 1
  • 14. OR gate  The OR gate has the following symbol and logic table.  Two or more input bits produce one output bit.  Either inputs must be true (1) for the output to be true. A B Q 0 0 0 0 1 1 1 0 1 1 1 1
  • 15. NOT gate  The simplest possible gate is called an "inverter," or a NOT gate.  One bit as input produces its opposite as output.  The symbol for a NOT gate in circuit diagrams is shown below.  The logic table for the NOT gate shows input and output. A Q 0 1 1 0
  • 16. Combine gates.  Gates can be combined.  The output of one gate can become the input of another.  Try to determine the logic table for this circuit.
  • 17. What happens when you add a NOT to an AND gate? Not A B Q 0 0 0 0 1 0 1 0 0 1 1 1 A B Q 0 0 1 0 1 1 1 0 1 1 1 0
  • 18. Can you make an AND gate from an NAND? A B Q 0 0 0 0 1 0 1 0 0 1 1 1
  • 19. “Exclusive” gates  Exclusively OR gate are true if either input is true but not both. A B Q 0 0 0 0 1 1 1 0 1 1 1 0 A B Q 0 0 1 0 1 0 1 0 0 1 1 1
  • 20. Truth Tables xy = x AND y = x * y x + y = x OR y x bar = NOT x AND is true only if OR is true if either NOT inverts the bit both inputs are true inputs are true We will denote x bar as ~X NOR is NOT of OR NAND is NOT of AND XOR is true if both inputs differ
  • 21. Logic Gates Here we see the logic gates that represent the boolean operations previously discussed XOR looks like OR but with the added curved line We typically represent NOR and NAND by the two on the left, but the two on the right are also correct
  • 22. How do we use gates to add two binary numbers?  Binary numbers are either 1 or 0, either on or off.  Have two outputs.  Need a gate to produce each output. 0 0 1 1 + 0 + 1 + 0 + 1 00 01 01 10 A B Q CO 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1
  • 23. An Example: Half Adder • There are 4 possibilities when adding 2 bits together: 0 + 0 0 + 1 1 + 0 1 + 1 • In the first case, we have a sum of 0 and a carry of 0 • In the second and third cases, we have a sum of 1 and a carry of 0 • In the last case, we have a sum of 0 and a carry of 1 • These patterns are demonstrated in the truth table above to the right • Notice that sum computes the same as XOR and carry computes the same as AND • We build an Adder using just one XOR and one AND gate The truth table for Sum and Carry and a circuit to compute these
  • 24. Full Adder  The half adder really only does half the work ◦ adds 2 bits, but only 2 bits  If we want to add 2 n-bit numbers, we need to also include the carry in from the previous half adder ◦ So, our circuit becomes more complicated  In adding 3 bits (one bit from x, one bit from y, and the carry in from the previous addition), we have 8 possibilities ◦ The sum will either be 0 or 1 and the carry out will either be 0 or 1 ◦ The truth table is given to the right
  • 25. Building a Full Adder Circuit  The sum is 1 only if one of x, y and carry in are 1, or if all three are 1, the sum is 0 otherwise  The carry out is 1 if two or three of x, y and carry in were 1, 0 otherwise ◦ The circuit to the right captures this by using 2 XOR gates for Sum and 2 AND gates and an OR gate for Carry Out