SlideShare a Scribd company logo
Foundations of Logic
Mathematical Logic is a tool for working with
elaborate compound statements. It includes:
• A formal language for expressing them.
• A concise notation for writing them.
• A methodology for objectively reasoning
about their truth or falsity.
• It is the foundation for expressing formal
proofs in all branches of mathematics.
Foundations of Logic: Overview
• Propositional logic (§1.1-1.2):
– Basic definitions. (§1.1)
– Equivalence rules & derivations. (§1.2)
• Predicate logic (§1.3-1.4)
– Predicates.
– Quantified predicate expressions.
– Equivalences & derivations.
Propositional Logic (§1.1)
Propositional Logic is the logic of compound
statements built from simpler statements
using so-called Boolean connectives.
Some applications in computer science:
• Design of digital electronic circuits.
• Expressing conditions in programs.
• Queries to databases & search engines.
Topic #1 – Propositional Logic
George Boole
(1815-1864)
Chrysippus of Soli
(ca. 281 B.C. – 205 B.C.)
Definition of a Proposition
Definition: A proposition (denoted p, q, r, …) is simply:
• a statement (i.e., a declarative sentence)
– with some definite meaning, (not vague or ambiguous)
• having a truth value that’s either true (T) or false (F)
– it is never both, neither, or somewhere “in between!”
• However, you might not know the actual truth value,
• and, the value might depend on the situation or context.
• Later, we will study probability theory, in which we assign degrees
of certainty (“between” T and F) to propositions.
– But for now: think True/False only!
Topic #1 – Propositional Logic
Examples of Propositions
• “It is raining.” (In a given situation.)
• “Beijing is the capital of China.” • “1 + 2 = 3”
But, the following are NOT propositions:
• “Who’s there?” (interrogative, question)
• “La la la la la.” (meaningless interjection)
• “Just do it!” (imperative, command)
• “Yeah, I sorta dunno, whatever...” (vague)
• “1 + 2” (expression with a non-true/false value)
Topic #1 – Propositional Logic
An operator or connective combines one or
more operand expressions into a larger
expression. (E.g., “+” in numeric exprs.)
• Unary operators take 1 operand (e.g., −3);
binary operators take 2 operands (eg 3  4).
• Propositional or Boolean operators operate
on propositions (or their truth values)
instead of on numbers.
Operators / Connectives
Topic #1.0 – Propositional Logic: Operators
Some Popular Boolean Operators
Formal Name Nickname Arity Symbol
Negation operator NOT Unary ¬
Conjunction operator AND Binary 
Disjunction operator OR Binary 
Exclusive-OR operator XOR Binary 
Implication operator IMPLIES Binary 
Biconditional operator IFF Binary ↔
Topic #1.0 – Propositional Logic: Operators
The Negation Operator
The unary negation operator “¬” (NOT)
transforms a prop. into its logical negation.
E.g. If p = “I have brown hair.”
then ¬p = “I do not have brown hair.”
The truth table for NOT: p p
T F
F T
T :≡ True; F :≡ False
“:≡” means “is defined as”
Operand
column
Result
column
Topic #1.0 – Propositional Logic: Operators
The Conjunction Operator
The binary conjunction operator “” (AND)
combines two propositions to form their
logical conjunction.
E.g. If p=“I will have salad for lunch.” and
q=“I will have steak for dinner.”, then
pq=“I will have salad for lunch and
I will have steak for dinner.”
Remember: “” points up like an “A”, and it means “ND”
ND
Topic #1.0 – Propositional Logic: Operators
• Note that a
conjunction
p1  p2  …  pn
of n propositions
will have 2n rows
in its truth table.
• Also: ¬ and  operations together are suffi-
cient to express any Boolean truth table!
Conjunction Truth Table
p q pq
F F F
F T F
T F F
T T T
Operand columns
Topic #1.0 – Propositional Logic: Operators
The Disjunction Operator
The binary disjunction operator “” (OR)
combines two propositions to form their
logical disjunction.
p=“My car has a bad engine.”
q=“My car has a bad carburetor.”
pq=“Either my car has a bad engine, or
my car has a bad carburetor.” After the downward-
pointing “axe” of “”
splits the wood, you
can take 1 piece OR the
other, or both.

Topic #1.0 – Propositional Logic: Operators
Meaning is like “and/or” in English.
• Note that pq means
that p is true, or q is
true, or both are true!
• So, this operation is
also called inclusive or,
because it includes the
possibility that both p and q are true.
• “¬” and “” together are also universal.
Disjunction Truth Table
p q pq
F F F
F T T
T F T
T T T
Note
difference
from AND
Topic #1.0 – Propositional Logic: Operators
Nested Propositional Expressions
• Use parentheses to group sub-expressions:
“I just saw my old friend, and either he’s
grown or I’ve shrunk.” = f  (g  s)
– (f  g)  s would mean something different
– f  g  s would be ambiguous
• By convention, “¬” takes precedence over
both “” and “”.
– ¬s  f means (¬s)  f , not ¬ (s  f)
Topic #1.0 – Propositional Logic: Operators
A Simple Exercise
Let p=“It rained last night”,
q=“The sprinklers came on last night,”
r=“The lawn was wet this morning.”
Translate each of the following into English:
¬p =
r  ¬p =
¬ r  p  q =
“It didn’t rain last night.”
“The lawn was wet this morning, and
it didn’t rain last night.”
“Either the lawn wasn’t wet this
morning, or it rained last night, or
the sprinklers came on last night.”
Topic #1.0 – Propositional Logic: Operators
The Exclusive Or Operator
The binary exclusive-or operator “” (XOR)
combines two propositions to form their
logical “exclusive or” (exjunction?).
p = “I will earn an A in this course,”
q = “I will drop this course,”
p  q = “I will either earn an A in this course,
or I will drop it (but not both!)”
Topic #1.0 – Propositional Logic: Operators
• Note that pq means
that p is true, or q is
true, but not both!
• This operation is
called exclusive or,
because it excludes the
possibility that both p and q are true.
• “¬” and “” together are not universal.
Exclusive-Or Truth Table
p q pq
F F F
F T T
T F T
T T F Note
difference
from OR.
Topic #1.0 – Propositional Logic: Operators
Note that English “or” can be ambiguous
regarding the “both” case!
“Pat is a singer or
Pat is a writer.” -
“Pat is a man or
Pat is a woman.” -
Need context to disambiguate the meaning!
For this class, assume “or” means inclusive.
Natural Language is Ambiguous
p q p "or" q
F F F
F T T
T F T
T T ?


Topic #1.0 – Propositional Logic: Operators
The Implication Operator
The implication p  q states that p implies q.
I.e., If p is true, then q is true; but if p is not
true, then q could be either true or false.
E.g., let p = “You study hard.”
q = “You will get a good grade.”
p  q = “If you study hard, then you will get
a good grade.” (else, it could go either way)
Topic #1.0 – Propositional Logic: Operators
antecedent consequent
Examples of Implications
• “If this lecture ends, then the sun will rise
tomorrow.” True or False?
• “If Tuesday is a day of the week, then I am
a penguin.” True or False?
• “If 1+1=6, then Bush is president.”
True or False?
• “If the moon is made of green cheese, then I
am richer than Bill Gates.” True or False?
Topic #1.0 – Propositional Logic: Operators
Why does this seem wrong?
• Consider a sentence like,
– “If I wear a red shirt tomorrow, then Osama bin Laden
will be captured!”
• In logic, we consider the sentence True so long as
either I don’t wear a red shirt, or Osama is caught.
• But, in normal English conversation, if I were to
make this claim, you would think that I was lying.
– Why this discrepancy between logic & language?
Resolving the Discrepancy
• In English, a sentence “if p then q” usually really
implicitly means something like,
– “In all possible situations, if p then q.”
• That is, “For p to be true and q false is impossible.”
• Or, “I guarantee that no matter what, if p, then q.”
• This can be expressed in predicate logic as:
– “For all situations s, if p is true in situation s, then q is also
true in situation s”
– Formally, we could write: s, P(s) → Q(s)
• That sentence is logically False in our example,
because for me to wear a red shirt and for Osama to
stay free is a possible (even if not actual) situation.
– Natural language and logic then agree with each other.
English Phrases Meaning p  q
• “p implies q”
• “if p, then q”
• “if p, q”
• “when p, q”
• “whenever p, q”
• “q if p”
• “q when p”
• “q whenever p”
• “p only if q”
• “p is sufficient for q”
• “q is necessary for p”
• “q follows from p”
• “q is implied by p”
We will see some equivalent
logic expressions later.
Topic #1.0 – Propositional Logic: Operators
Converse, Inverse, Contrapositive
Some terminology, for an implication p  q:
• Its converse is: q  p.
• Its inverse is: ¬p  ¬q.
• Its contrapositive: ¬q  ¬ p.
• One of these three has the same meaning
(same truth table) as p  q. Can you figure
out which?
Topic #1.0 – Propositional Logic: Operators
How do we know for sure?
Proving the equivalence of p  q and its
contrapositive using truth tables:
p q q p pq q p
F F T T T T
F T F T T T
T F T F F F
T T F F T T
Topic #1.0 – Propositional Logic: Operators
The biconditional operator
The biconditional p  q states that p is true if and
only if (IFF) q is true.
p = “Bush wins the 2004 election.”
q = “Bush will be president for all of 2005.”
p  q = “If, and only if, Bush wins the 2004
election, Bush will be president for all of 2005.”
Topic #1.0 – Propositional Logic: Operators
2004
I’m still
here!
2005
Biconditional Truth Table
• p  q means that p and q
have the same truth value.
• Note this truth table is the
exact opposite of ’s!
Thus, p  q means ¬(p  q)
• p  q does not imply
that p and q are true, or cause each other.
p q p  q
F F T
F T F
T F F
T T T
Topic #1.0 – Propositional Logic: Operators
Boolean Operations Summary
• We have seen 1 unary operator (out of the 4
possible) and 5 binary operators (out of the
16 possible). Their truth tables are below.
p q p pq pq pq pq pq
F F T F F F T T
F T T F T T T F
T F F F T T F F
T T F T T F T T
Topic #1.0 – Propositional Logic: Operators
Some Alternative Notations
Name: not and or xor implies iff
Propositional logic:      
Boolean algebra: p pq + 
C/C++/Java (wordwise): ! && || != ==
C/C++/Java (bitwise): ~ & | ^
Logic gates:
Topic #1.0 – Propositional Logic: Operators
Bit Strings
• A Bit string of length n is an ordered series
or sequence of n0 bits.
– More on sequences in §3.2.
• By convention, bit strings are written left to
right: e.g. the first bit of “1001101010” is 1.
• When a bit string represents a base-2
number, by convention the first bit is the
most significant bit. Ex. 11012=8+4+1=13.
Topic #2 – Bits
Counting in Binary
• Did you know that you can count
to 1,023 just using two hands?
– How? Count in binary!
• Each finger (up/down) represents 1 bit.
• To increment: Flip the rightmost (low-order) bit.
– If it changes 1→0, then also flip the next bit to the left,
• If that bit changes 1→0, then flip the next one, etc.
• 0000000000, 0000000001, 0000000010, …
…, 1111111101, 1111111110, 1111111111
Topic #2 – Bits
End of §1.1
You have learned about:
• Propositions: What
they are.
• Propositional logic
operators’
– Symbolic notations.
– English equivalents.
– Logical meaning.
– Truth tables.
• Atomic vs. compound
propositions.
• Alternative notations.
• Bits and bit-strings.
• Next section: §1.2
– Propositional
equivalences.
– How to prove them.

More Related Content

Similar to 4535092.ppt

Discrete mathematics Chapter1 presentation.ppt
Discrete mathematics Chapter1 presentation.pptDiscrete mathematics Chapter1 presentation.ppt
Discrete mathematics Chapter1 presentation.ppt
NandiniSR2
 
Logic in Computer Science Unit 2 (1).pptx
Logic in Computer Science Unit 2 (1).pptxLogic in Computer Science Unit 2 (1).pptx
Logic in Computer Science Unit 2 (1).pptx
PriyalMayurManvar
 
lectures in prolog in order to advance in artificial intelligence
lectures in prolog in order to advance in artificial intelligencelectures in prolog in order to advance in artificial intelligence
lectures in prolog in order to advance in artificial intelligence
AlaaCHOUMANE
 
Chapter 1: The Foundations: Logic and Proofs
Chapter 1: The Foundations: Logic and ProofsChapter 1: The Foundations: Logic and Proofs
Chapter 1: The Foundations: Logic and Proofs
ProfSHananeel
 
S2 1
S2 1S2 1
S2 1
IIUM
 
L01.ppt
L01.pptL01.ppt
Discrete mathematics suraj ppt
Discrete mathematics suraj pptDiscrete mathematics suraj ppt
Discrete mathematics suraj ppt
AshiskumarDash2
 
1. Introduction to math logic.pptx
1. Introduction to math logic.pptx1. Introduction to math logic.pptx
1. Introduction to math logic.pptx
ssuserabc12e
 
Nsu module 01-logic-final
Nsu module 01-logic-finalNsu module 01-logic-final
Nsu module 01-logic-final
SOURAV
 
Logic
LogicLogic
Logic
Yasir Khan
 
CSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptxCSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptx
AjayPratap828815
 
Dm1
Dm1Dm1
AppTheories_L3
AppTheories_L3AppTheories_L3
AppTheories_L3
Manu Muñoz H
 
ICS1019.pdf
ICS1019.pdfICS1019.pdf
ICS1019.pdf
Matt Montebello
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
SHUBHAM KUMAR GUPTA
 
Knowledge based agent
Knowledge based agentKnowledge based agent
Knowledge based agent
Shiwani Gupta
 
Ics1019 ics5003
Ics1019 ics5003Ics1019 ics5003
Ics1019 ics5003
Matt Montebello
 
PNP.pptx
PNP.pptxPNP.pptx
PNP.pptx
RishuRaj953240
 
PNP.pptx
PNP.pptxPNP.pptx
predicateLogic.ppt
predicateLogic.pptpredicateLogic.ppt
predicateLogic.ppt
MUZAMILALI48
 

Similar to 4535092.ppt (20)

Discrete mathematics Chapter1 presentation.ppt
Discrete mathematics Chapter1 presentation.pptDiscrete mathematics Chapter1 presentation.ppt
Discrete mathematics Chapter1 presentation.ppt
 
Logic in Computer Science Unit 2 (1).pptx
Logic in Computer Science Unit 2 (1).pptxLogic in Computer Science Unit 2 (1).pptx
Logic in Computer Science Unit 2 (1).pptx
 
lectures in prolog in order to advance in artificial intelligence
lectures in prolog in order to advance in artificial intelligencelectures in prolog in order to advance in artificial intelligence
lectures in prolog in order to advance in artificial intelligence
 
Chapter 1: The Foundations: Logic and Proofs
Chapter 1: The Foundations: Logic and ProofsChapter 1: The Foundations: Logic and Proofs
Chapter 1: The Foundations: Logic and Proofs
 
S2 1
S2 1S2 1
S2 1
 
L01.ppt
L01.pptL01.ppt
L01.ppt
 
Discrete mathematics suraj ppt
Discrete mathematics suraj pptDiscrete mathematics suraj ppt
Discrete mathematics suraj ppt
 
1. Introduction to math logic.pptx
1. Introduction to math logic.pptx1. Introduction to math logic.pptx
1. Introduction to math logic.pptx
 
Nsu module 01-logic-final
Nsu module 01-logic-finalNsu module 01-logic-final
Nsu module 01-logic-final
 
Logic
LogicLogic
Logic
 
CSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptxCSE680-17NP-Complete.pptx
CSE680-17NP-Complete.pptx
 
Dm1
Dm1Dm1
Dm1
 
AppTheories_L3
AppTheories_L3AppTheories_L3
AppTheories_L3
 
ICS1019.pdf
ICS1019.pdfICS1019.pdf
ICS1019.pdf
 
Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)Predicate logic_2(Artificial Intelligence)
Predicate logic_2(Artificial Intelligence)
 
Knowledge based agent
Knowledge based agentKnowledge based agent
Knowledge based agent
 
Ics1019 ics5003
Ics1019 ics5003Ics1019 ics5003
Ics1019 ics5003
 
PNP.pptx
PNP.pptxPNP.pptx
PNP.pptx
 
PNP.pptx
PNP.pptxPNP.pptx
PNP.pptx
 
predicateLogic.ppt
predicateLogic.pptpredicateLogic.ppt
predicateLogic.ppt
 

More from ntabdelnaiem

transport.pdf
transport.pdftransport.pdf
transport.pdf
ntabdelnaiem
 
tutorial 3.pptx
tutorial 3.pptxtutorial 3.pptx
tutorial 3.pptx
ntabdelnaiem
 
9108528.ppt
9108528.ppt9108528.ppt
9108528.ppt
ntabdelnaiem
 
8076892 (1).ppt
8076892 (1).ppt8076892 (1).ppt
8076892 (1).ppt
ntabdelnaiem
 
6262846.ppt
6262846.ppt6262846.ppt
6262846.ppt
ntabdelnaiem
 
Nested-Loops.pptx
Nested-Loops.pptxNested-Loops.pptx
Nested-Loops.pptx
ntabdelnaiem
 
loops_part1.pptx
loops_part1.pptxloops_part1.pptx
loops_part1.pptx
ntabdelnaiem
 
If.pptx
If.pptxIf.pptx
If.pptx
ntabdelnaiem
 

More from ntabdelnaiem (8)

transport.pdf
transport.pdftransport.pdf
transport.pdf
 
tutorial 3.pptx
tutorial 3.pptxtutorial 3.pptx
tutorial 3.pptx
 
9108528.ppt
9108528.ppt9108528.ppt
9108528.ppt
 
8076892 (1).ppt
8076892 (1).ppt8076892 (1).ppt
8076892 (1).ppt
 
6262846.ppt
6262846.ppt6262846.ppt
6262846.ppt
 
Nested-Loops.pptx
Nested-Loops.pptxNested-Loops.pptx
Nested-Loops.pptx
 
loops_part1.pptx
loops_part1.pptxloops_part1.pptx
loops_part1.pptx
 
If.pptx
If.pptxIf.pptx
If.pptx
 

Recently uploaded

How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
spdendr
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 

Recently uploaded (20)

How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Solutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptxSolutons Maths Escape Room Spatial .pptx
Solutons Maths Escape Room Spatial .pptx
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 

4535092.ppt

  • 1. Foundations of Logic Mathematical Logic is a tool for working with elaborate compound statements. It includes: • A formal language for expressing them. • A concise notation for writing them. • A methodology for objectively reasoning about their truth or falsity. • It is the foundation for expressing formal proofs in all branches of mathematics.
  • 2. Foundations of Logic: Overview • Propositional logic (§1.1-1.2): – Basic definitions. (§1.1) – Equivalence rules & derivations. (§1.2) • Predicate logic (§1.3-1.4) – Predicates. – Quantified predicate expressions. – Equivalences & derivations.
  • 3. Propositional Logic (§1.1) Propositional Logic is the logic of compound statements built from simpler statements using so-called Boolean connectives. Some applications in computer science: • Design of digital electronic circuits. • Expressing conditions in programs. • Queries to databases & search engines. Topic #1 – Propositional Logic George Boole (1815-1864) Chrysippus of Soli (ca. 281 B.C. – 205 B.C.)
  • 4. Definition of a Proposition Definition: A proposition (denoted p, q, r, …) is simply: • a statement (i.e., a declarative sentence) – with some definite meaning, (not vague or ambiguous) • having a truth value that’s either true (T) or false (F) – it is never both, neither, or somewhere “in between!” • However, you might not know the actual truth value, • and, the value might depend on the situation or context. • Later, we will study probability theory, in which we assign degrees of certainty (“between” T and F) to propositions. – But for now: think True/False only! Topic #1 – Propositional Logic
  • 5. Examples of Propositions • “It is raining.” (In a given situation.) • “Beijing is the capital of China.” • “1 + 2 = 3” But, the following are NOT propositions: • “Who’s there?” (interrogative, question) • “La la la la la.” (meaningless interjection) • “Just do it!” (imperative, command) • “Yeah, I sorta dunno, whatever...” (vague) • “1 + 2” (expression with a non-true/false value) Topic #1 – Propositional Logic
  • 6. An operator or connective combines one or more operand expressions into a larger expression. (E.g., “+” in numeric exprs.) • Unary operators take 1 operand (e.g., −3); binary operators take 2 operands (eg 3  4). • Propositional or Boolean operators operate on propositions (or their truth values) instead of on numbers. Operators / Connectives Topic #1.0 – Propositional Logic: Operators
  • 7. Some Popular Boolean Operators Formal Name Nickname Arity Symbol Negation operator NOT Unary ¬ Conjunction operator AND Binary  Disjunction operator OR Binary  Exclusive-OR operator XOR Binary  Implication operator IMPLIES Binary  Biconditional operator IFF Binary ↔ Topic #1.0 – Propositional Logic: Operators
  • 8. The Negation Operator The unary negation operator “¬” (NOT) transforms a prop. into its logical negation. E.g. If p = “I have brown hair.” then ¬p = “I do not have brown hair.” The truth table for NOT: p p T F F T T :≡ True; F :≡ False “:≡” means “is defined as” Operand column Result column Topic #1.0 – Propositional Logic: Operators
  • 9. The Conjunction Operator The binary conjunction operator “” (AND) combines two propositions to form their logical conjunction. E.g. If p=“I will have salad for lunch.” and q=“I will have steak for dinner.”, then pq=“I will have salad for lunch and I will have steak for dinner.” Remember: “” points up like an “A”, and it means “ND” ND Topic #1.0 – Propositional Logic: Operators
  • 10. • Note that a conjunction p1  p2  …  pn of n propositions will have 2n rows in its truth table. • Also: ¬ and  operations together are suffi- cient to express any Boolean truth table! Conjunction Truth Table p q pq F F F F T F T F F T T T Operand columns Topic #1.0 – Propositional Logic: Operators
  • 11. The Disjunction Operator The binary disjunction operator “” (OR) combines two propositions to form their logical disjunction. p=“My car has a bad engine.” q=“My car has a bad carburetor.” pq=“Either my car has a bad engine, or my car has a bad carburetor.” After the downward- pointing “axe” of “” splits the wood, you can take 1 piece OR the other, or both.  Topic #1.0 – Propositional Logic: Operators Meaning is like “and/or” in English.
  • 12. • Note that pq means that p is true, or q is true, or both are true! • So, this operation is also called inclusive or, because it includes the possibility that both p and q are true. • “¬” and “” together are also universal. Disjunction Truth Table p q pq F F F F T T T F T T T T Note difference from AND Topic #1.0 – Propositional Logic: Operators
  • 13. Nested Propositional Expressions • Use parentheses to group sub-expressions: “I just saw my old friend, and either he’s grown or I’ve shrunk.” = f  (g  s) – (f  g)  s would mean something different – f  g  s would be ambiguous • By convention, “¬” takes precedence over both “” and “”. – ¬s  f means (¬s)  f , not ¬ (s  f) Topic #1.0 – Propositional Logic: Operators
  • 14. A Simple Exercise Let p=“It rained last night”, q=“The sprinklers came on last night,” r=“The lawn was wet this morning.” Translate each of the following into English: ¬p = r  ¬p = ¬ r  p  q = “It didn’t rain last night.” “The lawn was wet this morning, and it didn’t rain last night.” “Either the lawn wasn’t wet this morning, or it rained last night, or the sprinklers came on last night.” Topic #1.0 – Propositional Logic: Operators
  • 15. The Exclusive Or Operator The binary exclusive-or operator “” (XOR) combines two propositions to form their logical “exclusive or” (exjunction?). p = “I will earn an A in this course,” q = “I will drop this course,” p  q = “I will either earn an A in this course, or I will drop it (but not both!)” Topic #1.0 – Propositional Logic: Operators
  • 16. • Note that pq means that p is true, or q is true, but not both! • This operation is called exclusive or, because it excludes the possibility that both p and q are true. • “¬” and “” together are not universal. Exclusive-Or Truth Table p q pq F F F F T T T F T T T F Note difference from OR. Topic #1.0 – Propositional Logic: Operators
  • 17. Note that English “or” can be ambiguous regarding the “both” case! “Pat is a singer or Pat is a writer.” - “Pat is a man or Pat is a woman.” - Need context to disambiguate the meaning! For this class, assume “or” means inclusive. Natural Language is Ambiguous p q p "or" q F F F F T T T F T T T ?   Topic #1.0 – Propositional Logic: Operators
  • 18. The Implication Operator The implication p  q states that p implies q. I.e., If p is true, then q is true; but if p is not true, then q could be either true or false. E.g., let p = “You study hard.” q = “You will get a good grade.” p  q = “If you study hard, then you will get a good grade.” (else, it could go either way) Topic #1.0 – Propositional Logic: Operators antecedent consequent
  • 19. Examples of Implications • “If this lecture ends, then the sun will rise tomorrow.” True or False? • “If Tuesday is a day of the week, then I am a penguin.” True or False? • “If 1+1=6, then Bush is president.” True or False? • “If the moon is made of green cheese, then I am richer than Bill Gates.” True or False? Topic #1.0 – Propositional Logic: Operators
  • 20. Why does this seem wrong? • Consider a sentence like, – “If I wear a red shirt tomorrow, then Osama bin Laden will be captured!” • In logic, we consider the sentence True so long as either I don’t wear a red shirt, or Osama is caught. • But, in normal English conversation, if I were to make this claim, you would think that I was lying. – Why this discrepancy between logic & language?
  • 21. Resolving the Discrepancy • In English, a sentence “if p then q” usually really implicitly means something like, – “In all possible situations, if p then q.” • That is, “For p to be true and q false is impossible.” • Or, “I guarantee that no matter what, if p, then q.” • This can be expressed in predicate logic as: – “For all situations s, if p is true in situation s, then q is also true in situation s” – Formally, we could write: s, P(s) → Q(s) • That sentence is logically False in our example, because for me to wear a red shirt and for Osama to stay free is a possible (even if not actual) situation. – Natural language and logic then agree with each other.
  • 22. English Phrases Meaning p  q • “p implies q” • “if p, then q” • “if p, q” • “when p, q” • “whenever p, q” • “q if p” • “q when p” • “q whenever p” • “p only if q” • “p is sufficient for q” • “q is necessary for p” • “q follows from p” • “q is implied by p” We will see some equivalent logic expressions later. Topic #1.0 – Propositional Logic: Operators
  • 23. Converse, Inverse, Contrapositive Some terminology, for an implication p  q: • Its converse is: q  p. • Its inverse is: ¬p  ¬q. • Its contrapositive: ¬q  ¬ p. • One of these three has the same meaning (same truth table) as p  q. Can you figure out which? Topic #1.0 – Propositional Logic: Operators
  • 24. How do we know for sure? Proving the equivalence of p  q and its contrapositive using truth tables: p q q p pq q p F F T T T T F T F T T T T F T F F F T T F F T T Topic #1.0 – Propositional Logic: Operators
  • 25. The biconditional operator The biconditional p  q states that p is true if and only if (IFF) q is true. p = “Bush wins the 2004 election.” q = “Bush will be president for all of 2005.” p  q = “If, and only if, Bush wins the 2004 election, Bush will be president for all of 2005.” Topic #1.0 – Propositional Logic: Operators 2004 I’m still here! 2005
  • 26. Biconditional Truth Table • p  q means that p and q have the same truth value. • Note this truth table is the exact opposite of ’s! Thus, p  q means ¬(p  q) • p  q does not imply that p and q are true, or cause each other. p q p  q F F T F T F T F F T T T Topic #1.0 – Propositional Logic: Operators
  • 27. Boolean Operations Summary • We have seen 1 unary operator (out of the 4 possible) and 5 binary operators (out of the 16 possible). Their truth tables are below. p q p pq pq pq pq pq F F T F F F T T F T T F T T T F T F F F T T F F T T F T T F T T Topic #1.0 – Propositional Logic: Operators
  • 28. Some Alternative Notations Name: not and or xor implies iff Propositional logic:       Boolean algebra: p pq +  C/C++/Java (wordwise): ! && || != == C/C++/Java (bitwise): ~ & | ^ Logic gates: Topic #1.0 – Propositional Logic: Operators
  • 29. Bit Strings • A Bit string of length n is an ordered series or sequence of n0 bits. – More on sequences in §3.2. • By convention, bit strings are written left to right: e.g. the first bit of “1001101010” is 1. • When a bit string represents a base-2 number, by convention the first bit is the most significant bit. Ex. 11012=8+4+1=13. Topic #2 – Bits
  • 30. Counting in Binary • Did you know that you can count to 1,023 just using two hands? – How? Count in binary! • Each finger (up/down) represents 1 bit. • To increment: Flip the rightmost (low-order) bit. – If it changes 1→0, then also flip the next bit to the left, • If that bit changes 1→0, then flip the next one, etc. • 0000000000, 0000000001, 0000000010, … …, 1111111101, 1111111110, 1111111111 Topic #2 – Bits
  • 31. End of §1.1 You have learned about: • Propositions: What they are. • Propositional logic operators’ – Symbolic notations. – English equivalents. – Logical meaning. – Truth tables. • Atomic vs. compound propositions. • Alternative notations. • Bits and bit-strings. • Next section: §1.2 – Propositional equivalences. – How to prove them.