Chapter 1, Part I: Propositional Logic
1
Chapter Summary
Propositional Logic
The Language of Propositions
Applications
Logical Equivalences
Predicate Logic
The Language of Quantifiers
Logical Equivalences
Nested Quantifiers
Proofs
Rules of Inference
Proof Methods
Proof Strategy
2
Propositional Logic Summary
The Language of Propositions
Connectives
Truth Values
Truth Tables
Applications
Translating English Sentences
System Specifications
Logic Puzzles
Logic Circuits
Logical Equivalences
Important Equivalences
Showing Equivalence
Satisfiability
3
Section 2.1
4
Section Summary
Propositions
Connectives
Negation
Conjunction
Disjunction
Implication; contrapositive, inverse, converse
Biconditional
Truth Tables
5
Propositions
A proposition is a declarative sentence that is either true or
false.
Examples of propositions:
a) Manama is the capital of Bahrain.
b) Toronto is the capital of Canada.
c) 1+0=1
d) 0+0=2
Examples that are not propositions.
a) Sit down!
b) What time is it?
c) x + 1 = 2
d) x + y = z
6
Propositional Logic
Constructing Propositions
Propositional Variables: p, q, r, s, …
The proposition that is always true is denoted by T and
the proposition that is always false is denoted by F.
Compound Propositions; constructed from logical
connectives and other propositions
Negation ¬
Conjunction ∧
Disjunction ∨
Implication →
Biconditional ↔
7
Compound Propositions: Negation
The negation of a proposition p is denoted by ¬p and
has this truth table:
p ¬p
T F
F T
Example: If p denotes “The earth is round.”, then ¬p
denotes “It is not the case that the earth is round,” or
more simply “The earth is not round.”
8
Conjunction (Logical AND)
The conjunction of propositions p and q is denoted
by p ∧ q and has this truth table:
p q p∧q
T T T
T F F
F T F
F F F
Example: If p denotes “I am at home.” and q denotes
“It is raining.” then p ∧q denotes “I am at home and it
is raining.”
9
Disjunction (Logical OR)
The disjunction of propositions p and q is denoted
by p ∨q and has this truth table:
p q p ∨q
T T T
T F T
F T T
F F F
Example: If p denotes “I am at home.” and q denotes
“It is raining.” then p ∨q denotes “I am at home or it is
raining.”
10
Implication
If p and q are propositions, then p →q is a conditional statement or
implication which is read as “if p, then q ” and has this truth table:
p q p →q
T T T
T F F
F T T
F F T
Example: If p denotes “It is raining.” and q denotes “the floor is
wet.” then p →q denotes “If it is raining, then the floor is wet.”
In p →q , p is the hypothesis (antecedent or premise) and q is
the conclusion (or consequence).
11
Understanding Implication
In p →q there does not need to be any connection
between the antecedent or the consequent. The
“meaning” of p →q depends only on the truth values of
p and q.
These implications are perfectly fine, but would not be
used in ordinary English.
“If the moon is made of green cheese, then I have more
money than Bill Gates. ”
“If the moon is made of green cheese then I’m on
welfare.”
“If 1 + 1 = 3, then your grandma wears combat boots.”
12
Understanding Implication (cont)
One way to view the logical conditional is to think of
an obligation or contract.
“If I am elected, then I will lower taxes.”
“If you get 100% on the final, then you will get an A.”
If the politician is elected and does not lower taxes,
then the voters can say that he or she has broken the
campaign pledge. Something similar holds for the
professor. This corresponds to the case where p is true
and q is false.
13
Different Ways of Expressing p →q
if p, then q p implies q
if p, q p only if q
q unless ¬p q when p
q if p q when p
q whenever p p is sufficient for q
q follows from p q is necessary for p
a necessary condition for p is q
a sufficient condition for q is p
14
Converse, Contrapositive, and Inverse
From p →q we can form new conditional statements .
The converse of p →q is q →p
The inverse of p →q is ¬p→¬q
the contrapositive of p →q is ¬q → ¬ p
Example 1: Find the converse, inverse, and contrapositive
of “It is raining is a sufficient condition for me not going to
town.”
“If It is raining then I’m not going to town”
Solution:
converse: If I do not go to town, then it is raining.
inverse: If it is not raining, then I will go to town.
contrapositive: If I go to town, then it is not raining.
15
Example on Converse, Contrapositive, and
Inverse
The converse of p →q is q →p
The inverse of p →q is ¬p→¬q
the contrapositive of p →q is ¬q → ¬ p
Example 2: Find the converse, inverse, and
contrapositive of “All students will pass if AI course is
not hard”
Converse: AI course is not hard if all students will pass.
inverse : all students will not pass if AI course is hard.
contrapositive : AI course is hard if all students will
not pass
16
Biconditional
If p and q are propositions, then we can form the biconditional
proposition p ↔q , read as “p if and only if q .” The biconditional
p ↔q denotes the proposition with this truth table:
p q p ↔q
T T T
T F F
F T F
F F T
If p denotes “I am at home.” and q denotes “It is raining.” then
p ↔q denotes “I am at home if and only if it is raining.”
17
Expressing the Biconditional
Some alternative ways “p if and only if q” is expressed
in English:
p is necessary and sufficient for q
if p then q , and conversely
p iff q
18
Truth Tables For Compound
Propositions
Construction of a truth table:
Rows
Need a row for every possible combination of values for
the atomic propositions.
Columns
Need a column for the compound proposition (usually
at far right)
Need a column for the truth value of each expression
that occurs in the compound proposition as it is built
up.
This includes the atomic propositions
19
Example Truth Table
Construct a truth table for
p q r ¬r p∨q p ∨ q → ¬r
T T T F T F
T T F T T T
T F T F T F
T F F T T T
F T T F T F
F T F T T T
F F T F F T
F F F T F T
20
Exercise on truth table
Construct a truth table for :
( p ∨ ¬ q ) → ( p ∧ q)
21
Equivalent Propositions
Two propositions are equivalent if they always have the
same truth value.
Example: Show using a truth table that the
biconditional is equivalent to the contrapositive.
p →q ≡ ¬q → ¬ p
p q ¬p ¬q p →q ¬q → ¬ p
Solution:
T T F F T T
T F F T F F
F T T F T T
F F T T T T
22
Using a Truth Table to Show Non-
Equivalence
Example: Show using truth tables that neither the
converse nor inverse of an implication are not
equivalent to the implication.
q →p is the converse of p →q
¬ p → ¬ q is the inverse of p →q
p q ¬p ¬q p →q ¬ p →¬ q q→p
Solution:
T T F F T T T
T F F T F T T
F T T F T F F
F F T T T T T
23
Problem
How many rows are there in a truth table with n
propositional variables?
Solution: 2n
Note that this means that with n propositional
variables, we can construct 2n distinct (i.e., not
equivalent) propositions.
24
Precedence of Logical Operators
Operator Precedence
¬ 1
∧ 2
∨ 3
→ 4
↔ 5
p ∨q → ¬r is equivalent to (p ∨q) → ¬r
If the intended meaning is p ∨(q → ¬r )
then parentheses must be used.
25
Section 2.2
26
Applications of Propositional Logic:
Summary
Translating English to Propositional Logic
System Specifications
Boolean Searching
Logic Puzzles
Logic Circuits
AI Diagnosis Method (Optional)
27
Translating English Sentences
Steps to convert an English sentence to a statement in
propositional logic
Identify atomic propositions and represent using
propositional variables.
Determine appropriate logical connectives
“If I go to Bader ‘s or to the country, I will not go
shopping.”
p: I go to Bader ‘s If p or q then not r.
q: I go to the country.
r: I will go shopping.
28
Example
Problem: Translate the following sentence into
propositional logic:
“You can access the Internet from campus only if you are
a computer science major or you are not a freshman.”
One Solution: Let a, c, and f represent respectively
“You can access the internet from campus,” “You are a
computer science major,” and “You are a freshman.”
a→ (c ∨ ¬ f )
29
System Specifications
System and Software engineers take requirements in
English and express them in a precise specification
language based on logic.
Example: Express in propositional logic:
“The automated reply cannot be sent when the file
system is full”
Solution: One possible solution: Let p denote “The
automated reply can be sent” and q denote “The file
system is full.”
q→ ¬ p
30
Section 1.3
31
Tautologies, Contradictions, and
Contingencies
A tautology is a proposition which is always true.
Example: p ∨¬p
A contradiction is a proposition which is always false.
Example: p ∧¬p
A contingency is a proposition which is neither a
tautology nor a contradiction, such as p
P ¬p p ∨¬p p ∧¬p
T F T F
F T T F
32
Logically Equivalent
Two compound propositions p and q are logically equivalent if p↔q
is a tautology.
We write this as p⇔q or as p≡q where p and q are compound
propositions.
Two compound propositions p and q are equivalent if and only if the
columns in a truth table giving their truth values agree.
This truth table show ¬p ∨ q is equivalent to p → q.
p q ¬p ¬p ∨ q p→ q
T T F T T
T F F F F
F T T T T
F F T T T
33
De Morgan’s Laws
Augustus De Morgan
1806-1871
This truth table shows that De Morgan’s Second Law holds.
p q ¬p ¬q (p∨q) ¬(p∨q) ¬p∧¬q
T T F F T F F
T F F T T F F
F T T F T F F
F F T T F T T
34
Key Logical Equivalences
Identity Laws: ,
Domination Laws: ,
Idempotent laws: ,
Double Negation Law:
Negation Laws: ,
35
Key Logical Equivalences (cont)
Commutative Laws: ,
Associative Laws:
Distributive Laws:
Absorption Laws:
36
More Logical Equivalences
37
Equivalence Proofs
Example: Show that
is logically equivalent to
Solution:
38
Equivalence Proofs
Example: Show that
is a tautology.
Solution:
39
Exercise 1
Use truth tables to determine which of the following
are equivalent to each other:
(a) (P ∧ Q) ∨ (¬P ∧ ¬Q)
(b) ¬P ∨ Q
(c) (P ∨ ¬Q) ∧ (Q ∨ ¬P) (
(d) ¬(P ∨ Q)
(e) (Q ∧ P) ∨ ¬P
40
Exercise 2
Compute the truth table of (F ∨ G) ∧ ¬(F ∧ G).
41
Exercise 3
Use the truth tables method to determine whether
p → (q ∧ ¬q) and ¬p
are logically equivalent
42
Exercise 4
Let
A =“Aldo is Italian” and
B =“Bob is English”.
Formalize the following sentences:
1. “Aldo isn’t Italian”
¬A
2. “Aldo is Italian while Bob is English”
A∧B
3. “If Aldo is Italian then Bob is not English”
A → ¬B
43
Exercise 4
Let
A =“Aldo is Italian” and
B =“Bob is English”.
Formalize the following sentences:
4. “Aldo is Italian or if Aldo isn’t Italian then Bob is
English”
A ∨ (¬A → B) logically equivalent to A ∨ B
5. “Either Aldo is Italian and Bob is English, or neither
Aldo is Italian nor Bob is English”
(A ∧ B) ∨ (¬A ∧ ¬B) logically equivalent to A ↔ B
44