Small 09
Small 09
Part One
Announcements
● Problem Session tonight from 7:00 – 7:50
in 380-380X.
● Optional, but highly recommended!
● Problem Set 3 Checkpoint due right now.
● 2× Handouts
● Problem Set 3 Checkpoint Solutions
● Diagonalization
● Problem Set 2 Solutions distributed at end
of class.
Office Hours
● We finally have stable office hours
locations!
● Website will be updated soon with
details.
An Important Question
Commands
Commands
cannot
cannot be
be true
true
or
or false.
false.
Things That Aren't Propositions
Questions
Questions
cannot
cannot be
be true
true
or
or false.
false.
Things That Aren't Propositions
The
The first
first half
half
isis aa valid
valid
proposition.
proposition.
I am the walrus,
goo goo g'joob
Jibberish
Jibberish cannot
cannot
be
be true
true or
or
false.
false.
Propositional Logic
● Propositional logic is a mathematical system for
reasoning about propositions and how they relate to
one another.
● Propositional logic enables us to
● Formally encode how the truth of various propositions
influences the truth of other propositions.
● Determine if certain combinations of propositions are
always, sometimes, or never true.
● Determine whether certain combinations of propositions
logically entail other combinations.
Variables and Connectives
● Propositional logic is a formal mathematical
system whose syntax is rigidly specified.
● Every statement in propositional logic consists of
propositional variables combined via logical
connectives.
● Each variable represents some proposition, such as
“You wanted it” or “You should have put a ring on it.”
● Connectives encode how propositions are related,
such as “If you wanted it, you should have put a ring
on it.”
Propositional Variables
● Each proposition will be represented by a
propositional variable.
● Propositional variables are usually
represented as lower-case letters, such
as p, q, r, s, etc.
● If we need more, we can use subscripts: p1,
p2, etc.
● Each variable can take one one of two
values: true or false.
Logical Connectives
● Logical NOT: ¬p
●
Read “not p”
● ¬p is true if and only if p is false.
●
Also called logical negation.
● Logical AND: p ∧ q
●
Read “p and q.”
●
p ∧ q is true if both p and q are true.
●
Also called logical conjunction.
● Logical OR: p ∨ q
●
Read “p or q.”
● p ∨ q is true if at least one of p or q are true (inclusive OR)
●
Also called logical disjunction.
Truth Tables
p q p∧q
F F F
F T F
T F F
T T T
Truth Tables
p q p∨q
F F F
F T T
T F T
T T T
Truth Tables
p ¬p
F T
T F
Implication
● An important connective is logical
implication: p → q.
● Recall: p → q means “if p is true, q is true
as well.”
● Recall: p → q says nothing about what
happens if p is false.
● Recall: p → q says nothing about
causality; it just says that if p is true, q
will be true as well.
Implication, Diagrammatically
Any time P is
true, Q is
true as well.
P can be
true without
Q being
true as well
Set of where Q is true
Truth Table for Implication
p q p→q
F F T
F T T
T F F
T T T
The Biconditional
● The biconditional connective p ↔ q is
read “p if and only if q.”
● Intuitively, either both p and q are true,
or neither of them are.
p q p↔q
One interpretation of ↔ is
F F T to think of it as equality:
the two propositions must
F T F
have equal truth values.
T F F
T T T
True and False
● There are two more “connectives” to
speak of: true and false.
● The symbol ⊤ is a value that is always
true.
● The symbol ⊥ is value that is always
false.
● These are often called connectives,
though they don't connect anything.
● (Or rather, they connect zero things.)
Operator Precedence
● How do we parse this statement?
(¬x) → ((y ∨ z) → (x ∨ (y ∧ z)))
● Operator precedence for propositional logic:
¬
∧
∨
→
↔
● All operators are right-associative.
● We can use parentheses to disambiguate.
Recap So Far
● A propositional variable is a variable that is
either true or false.
● The logical connectives are
● Negation: ¬p
● Conjunction: p ∧ q
● Disjunction: p ∨ q
● Implication: p → q
● Biconditional: p ↔ q
● True: ⊤
● False: ⊥
Translating into Propositional Logic
Some Sample Propositions
a: There is a velociraptor outside my
apartment.
b: Velociraptors can open windows.
c: I am in my apartment right now.
d: My apartment has windows.
e: I am going to be eaten by a velociraptor
I won't be eaten by a velociraptor if there
isn't a velociraptor outside my apartment.
¬a → ¬e
“p if q”
translates to
q→p
It does not translate to
p→q
Some Sample Propositions
a: There is a velociraptor outside my
apartment.
b: Velociraptors can open windows.
c: I am in my apartment right now.
d: My apartment has windows.
e: I am going to be eaten by a velociraptor
If there is a velociraptor outside my
apartment, but it can't open windows, I am
not going to be eaten by a velociraptor.
a ∧ ¬b → ¬e
“p, but q”
translates to
p∧q
Some Sample Propositions
a: There is a velociraptor outside my
apartment.
b: Velociraptors can open windows.
c: I am in my apartment right now.
d: My apartment has windows.
e: I am going to be eaten by a velociraptor
c → ¬a
“p only when q”
translates to
p→q
The Takeaway Point
● When translating into or out of
propositional logic, be very careful not to
get tripped up by nuances of the English
language.
● In fact, this is one of the reasons we have a
symbolic notation in the first place!
● Many prepositions lead to
counterintuitive translations; make sure
to double-check yourself!
Logical Equivalence
More Elaborate Truth Tables
This gives the final
truth value for the
expression.
p q p ∧ (p → q)
F F F T
F T F T
T F F F
T T T T
Negations
● p ∧ q is false if and only if ¬(p ∧ q) is true.
● Intuitively, this is only possible if either p is false
or q is false (or both!)
● In propositional logic, we can write this as
¬p ∨ ¬q.
● How would we prove that ¬(p ∧ q) and ¬p ∨ ¬q
are equivalent?
●
Idea: Build truth tables for both expressions and
confirm that they always agree.
Negating AND
p q ¬(p ∧ q) p q ¬p ∨ ¬q
F F T F F F T T T
F T T F F T T T F
T F T F T F F T T
T T F T T T F F F
p q ¬(p → q) p q p ∧ ¬q
F F F T F F F F T
F T F T F T F F F
T F T F T F T T T
T T F T T T T F F
¬(p → q) ≡ p ∧ ¬q
An Important Observation
● We have just proven that
¬(p → q) ≡ p ∧ ¬q
● If we negate both sides, we get that
p → q ≡ ¬(p ∧ ¬q)
● By De Morgan's laws:
p → q ≡ ¬(p ∧ ¬q)
p → q ≡ ¬p ∨ ¬¬q
p → q ≡ ¬p ∨ q
●
Thus p → q ≡ ¬p ∨ q
Another Idea
● We've just shown that ¬(p → q) ≡ p ∧ ¬q.
● Is it also true that ¬(p → q) ≡ p → ¬q?
● Let's go check!
¬(p → q) and p → ¬q
p q ¬(p → q) p q p → ¬q
F F F T F F F T T
F T F T F T F T F
T F T F T F T T T
T T F T T T T F F
p q p→q p q ¬q → ¬p
F F T F F T T T
F T T F T F T T
T F F T F T F F
T T T T T F T F
p → q ≡ ¬q → ¬p
Why All This Matters
● Suppose we want to prove the following
statement:
“If x + y = 16, then x ≥ 8 or y ≥ 8”
x < 8 ∧ y < 8 → x + y ≠ 16
x+y<8+y
<8+8
= 16
p (¬p → ⊥) → p
F T F F T F
T F T F T T
This statement
is always true!
Tautologies
● A tautology is a statement that is always
true.
● Examples:
● ⊤
● p ∨ ¬p (the Law of the Excluded Middle)
● ⊥ → p (vacuous truth)
● Once a tautology has been proven, we
can use that tautology anywhere.
Next Time
● First-Order Logic
● How do we reason about multiple objects
and their properties?