02 Propositional Logic Equiv PDF
02 Propositional Logic Equiv PDF
Logic
CS A262: Discrete Structures
Propositions and Logical
Operations
2
Logic
3
Propositional Logic
▶ Example:
1 + 2 = 3 (T)
2 + 4 = 5 (F)
4
Propositions
▶ A fact-based declaration is a proposition.
▶ It does not matter if we know whether it is true or false.
▶ Examples:
2143 is a prime number.
Ouagadougou is the capital of Burkina Faso.
Louis XIII of France started the trend for men to wear wigs.
5
Propositions (cont.)
▶ Examples:
▶ Read this carefully. (not a proposition)
▶ What time is it? (not a proposition)
6
Propositions (cont.)
▶ Example:
x+3=5
We don’t know what x is.
This statement is neither true or false.
7
Propositional Variables
p, q, r, s…
8
Negation
▶
9
Negation (cont.)
10
Negation (cont.)
▶ Solution:
“It is not the case that today is Friday.”
“Today is not Friday.”
“It is not Friday today.”
11
Negation (cont.)
12
Negation (cont.)
▶ Solution:
“It is not the case that at least 2 inches of snow fell today.”
13
Conjunction
14
Conjunction (cont.)
15
Conjunction (cont.)
▶ Solution:
“Today is Friday, and it is raining today.”
16
Conjunction (cont.)
17
Disjunction
18
Disjunction (cont.)
19
Disjunction (cont.)
▶ Solution:
“Today is Friday or it is raining today.”
20
Disjunction (cont.)
▶ Solution:
“Today is This proposition is TRUE on any day that
Friday or it is is either Friday or a rainy day (including
raining today.” rainy Fridays).
It is only FALSE on days that are not
Fridays when it also does not rain.
21
Exclusive OR
22
Lecture Problems
You meet three inhabitants, A, B, and C, of Smullyan’s
Island. Using p to represent “A is truthful”, q to
represent the statement “B is truthful”, and r to
represent the statement “C is truthful”, how would
you write the following phrase?
a) p ∧ q
b) ~p ∧ q
c) ~p ∨ ~q
d) ~p ∧ ~q
23
Lecture Problems
You meet three inhabitants, A, B, and C, of Smullyan’s
Island. Using p to represent “A is truthful”, q to
represent the statement “B is truthful”, and r to
represent the statement “C is truthful”, how would
you write the following phrase?
d) ~p ∧ ~q
24
Lecture Problems
You meet three inhabitants, A, B, and C, of Smullyan’s
Island. Using p to represent “A is truthful”, q to
represent the statement “B is truthful”, and r to
represent the statement “C is truthful”, how would
you write the following phrase?
a) p ∧ q ∧ r
b) ~p ∧ ~q ∧ ~r
c) ~q ∧ ~r
d) ~p ∨ ~q ∨ ~r
25
Lecture Problems
You meet three inhabitants, A, B, and C, of Smullyan’s
Island. Using p to represent “A is truthful”, q to
represent the statement “B is truthful”, and r to
represent the statement “C is truthful”, how would
you write the following phrase?
b) ~p ∧ ~q ∧ ~r
26
Lecture Problems
You meet three inhabitants, A, B, and C, of Smullyan’s
Island. Using p to represent “A is truthful”, q to
represent the statement “B is truthful”, and r to
represent the statement “C is truthful”, how would
you write the following phrase?
a) q ⊕ r
b) ~q ∧ r
c) q ∨ r
d) q ⊕ ~q
27
Lecture Problems
You meet three inhabitants, A, B, and C, of Smullyan’s
Island. Using p to represent “A is truthful”, q to
represent the statement “B is truthful”, and r to
represent the statement “C is truthful”, how would
you write the following phrase?
a) q ⊕ r
28
Truth Tables
29
Truth Tables
▶ Example:
▶ Write the truth table for the conjunction p ∧ q
30
Truth Tables
▶ Example:
▶ Write the truth table for the conjunction p ∧ q
▶ The two variable are p and q
31
Truth Tables
▶ Example:
▶ Write the truth table for the conjunction p ∧ q
▶ The two variable are p and q
▶ How many possibilities are there?
32
Truth Tables
▶ Example:
▶ Write the truth table for the conjunction p ∧ q
▶ The two variable are p and q
▶ How many possibilities are there?
▶ p is TRUE, q is TRUE
▶ p is TRUE, q is FALSE
▶ p is FALSE, q is TRUE
▶ p is FALSE, q is FALSE
33
Truth Tables
▶ Example:
▶ Write the truth table for the conjunction p ∧ q
▶ The two variable are p and q
▶ How many possibilities are there? p q p∧q
▶ p is TRUE, q is TRUE T T
▶ p is TRUE, q is FALSE
T F
▶ p is FALSE, q is TRUE Set up the truth table
▶ p is FALSE, q is FALSE → F T
F F
34
Truth Tables
▶ Example:
▶ Write the truth table for the conjunction p ∧ q
▶ The two variable are p and q
▶ How many possibilities are there? p q p∧q
▶ p is TRUE, q is TRUE T T T
▶ p is TRUE, q is FALSE
▶ p is FALSE, q is TRUE
Add the resulting values →T F F
F T F
▶ p is FALSE, q is FALSE
F F F
35
Truth Tables
F T F T F T
F F F F F F
F T F F T T F T T
F F F F F F F F F
38
Example (cont.)
Two ➔ p, q
39
Example (cont.)
40
Example (cont.)
41
Example (cont.)
42
Example (cont.)
43
Example (cont.)
44
Example (cont.)
45
Example (cont.)
(p ∨ q) ∧ ~(p ∧ q)
46
Example (cont.)
(p ∨ q) ∧ ~(p ∧
q)
Negate the last
~(p ∧ statement.
p q (p ∨ q) (p ∧ q)
q)
T T T T ~(p ∧ q)
T F T F
F T T F
F F F F
47
Example (cont.)
48
Example (cont.)
(p ∨ q) ∧ ~(p ∧ q)
Combine.
~(p ∧
p q (p ∨ q) (p ∧ q) (p ∨ q) ∧ ~(p ∧ q)
q)
T T T T F
T F T F T
F T T F T
F F F F T
49
Example (cont.)
~(p ∧
p q (p ∨ q) (p ∧ q) (p ∨ q) ∧ ~(p ∧ q)
q)
T T T T F F
T F T F T T
F T T F T T
F F F F T F
50
Lecture Problems
Which of the following columns correctly shows
~p ∨ q?
p q A B C D
F F F T T F
F T T F T F
T F T T F F
T T T T T T
51
Lecture Problems
Which of the following columns correctly shows
~p ∨ q?
p q A B C D
F F F T T F
F T T F T F
T F T T F F
T T T T T T
52
Conditional Statements
53
Conditional Statement
▶ TRUE otherwise
p q p→q
T T T
T F F
F T T
F F T
54
Conditional Statement (cont.)
55
Lecture Problems
Consider the statement
If you are drinking beer, then you are at least 21
years old.
a) Yes
b) No
56
Lecture Problems
Consider the statement
If you are drinking beer, then you are at least 21
years old.
a) Yes
57
Lecture Problems
Consider the statement
If you are drinking beer, then you are at least 21
years old.
a) Yes
b) No
58
Lecture Problems
Consider the statement
If you are drinking beer, then you are at least 21
years old.
a) Yes
59
Lecture Problems
Consider the statement
If you are drinking beer, then you are at least 21
years old.
a) Yes
b) No
60
Lecture Problems
Consider the statement
If you are drinking beer, then you are at least 21
years old.
b) No
61
Conditional Statements
(cont.)
▶ Given p → q, we have three related conditional
statements:
Converse q→p
Contrapositive ~q → ~p
Inverse ~p → ~q
62
Conditional Statements
(cont.)
▶ What are the contrapositive, the converse, and the
inverse of the conditional statement below?
“I close the windows whenever it is raining.”
63
Conditional Statements
(cont.)
▶ What are the contrapositive, the converse, and the
inverse of the conditional statement below?
“I close the windows whenever it is raining.”
▶ Solution:
Let’s start by translating it to a conditional statement
“If it is raining, then I close the windows.”
64
Conditional Statements
(cont.)
▶ Once we have the conditional statement
“If it is raining, then I close the windows.”
We can find the
▶ Converse
“If I close the windows, then it is raining.”
▶ Contrapositive
“If I don’t close the windows, then it is not raining.”
▶ Inverse
“If it is not raining, then I do not close the windows.”
65
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
a. p→q
b. ~p → ~q
c. ~p → q
66
d. ~p ∧ q
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
c) ~p → q
67
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
course.
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
69
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
course.
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
71
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
course.
Lecture Problems
Consider the statement
If you don’t attend the concert, then you will get an F for
the course.
values
p q p⟷q
▶ FALSE otherwise
T T T
F T F
F F74 T
Biconditional Statements (cont.)
75
Biconditional Statements (cont.)
▶ Given the statement:
You can go to the concert if and only if you buy a
ticket.
▶ TRUE:
▶ You buy a ticket and can go to the concert
▶ You don’t buy the ticket and you cannot go to the
concert (because they will not let you in).
▶ FALSE:
▶ You do not buy a ticket and you can go to the
concert.
▶ You buy the ticket, and you cannot go to the concert
(because they will not let you in).
76
A Note about Biconditionals
▶ Example:
▶ English:
▶ “If you finish your homework, then you can
go out and play.”
▶ This implicitly means:
▶ “You can go out and play if and only if you
finish your homework.”
77
Operator Precedence
Example:
p∧r→q
will be evaluated
(p ∧ r) → q
78
Lecture Problems
When planning a party you want to know whom to invite. Among the
people you would like to invite are three touchy friends. You know
that if Jasmine attends, she will become unhappy if Samir is there,
Samir will attend only if Kanti will be there, and Kanti and Jasmine
will only attend together. Let J and S stand for the statements
“Jasmine will attend” and “Samir will attend”, respectively.
a) J -> ~S
b) ~J -> ~S
c) S -> J
d) ~S -> J
e) J <--> S
79
Lecture Problems
When planning a party you want to know whom to invite. Among the
people you would like to invite are three touchy friends. You know
that if Jasmine attends, she will become unhappy if Samir is there,
Samir will attend only if Kanti will be there, and Kanti and Jasmine
will only attend together. Let J and S stand for the statements
“Jasmine will attend” and “Samir will attend”, respectively.
a) J -> ~S
80
Lecture Problems
When planning a party you want to know whom to invite. Among the
people you would like to invite are three touchy friends.You know
that if Jasmine attends, she will become unhappy if Samir is there,
Samir will attend only if Kanti will be there, and Kanti and Jasmine
will only attend together. Let S and K stand for the statements
“Samir will attend” and “Kanti will attend”, respectively.
a) K -> ~S
b) ~K -> ~S
c) S -> K
d) ~S -> K
e) S <--> K
81
Lecture Problems
When planning a party you want to know whom to invite. Among the
people you would like to invite are three touchy friends.You know
that if Jasmine attends, she will become unhappy if Samir is there,
Samir will attend only if Kanti will be there, and Kanti and Jasmine
will only attend together. Let S and K stand for the statements
“Samir will attend” and “Kanti will attend”, respectively.
c) S -> K
82
Lecture Problems
When planning a party you want to know whom to invite. Among the
people you would like to invite are three touchy friends.You know
that if Jasmine attends, she will become unhappy if Samir is there,
Samir will attend only if Kanti will be there, and Kanti and Jasmine
will only attend together. Let J and K stand for the statements
“Jasmine will attend” and “Kanti will attend”, respectively.
a) J -> ~K
b) ~J -> ~K
c) K -> J
d) ~K -> J
e) K <--> J
83
Lecture Problems
When planning a party you want to know whom to invite. Among the
people you would like to invite are three touchy friends.You know
that if Jasmine attends, she will become unhappy if Samir is there,
Samir will attend only if Kanti will be there, and Kanti and Jasmine
will only attend together. Let J and K stand for the statements
“Jasmine will attend” and “Kanti will attend”, respectively.
e) K <--> J
84
Logical Equivalence
85
Propositional Equivalencies
87
Example
88
Example
89
Example
p ~p ~(~p)
T F T
F T F
~(p ∧ q) ≡ ~p ∨ ~q
~(p ∨ q) ≡ ~p ∧ ~q
91
De Morgan’s Law (cont.)
~(p ∨ q) ≡ ~p ∧ ~q
92
De Morgan’s Law (cont.)
~(p ∨ q) ≡ ~p ∧ ~q
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
93
De Morgan’s Law (cont.)
~(p ∨ q) ≡ ~p ∧ ~q
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T
T F
F T
F F Add the initial values for p and q.
94
De Morgan’s Law (cont.)
~(p ∨ q) ≡ ~p ∧ ~q
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T
T F T
F T T
F F F Keep on adding the values.
95
De Morgan’s Law (cont.)
~(p ∨ q) ≡ ~p ∧ ~q
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T F
T F T F The left side of the
F T T F equivalency is completed.
F F F T
96
De Morgan’s Law (cont.)
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T F
T F T F Now we need to work on the
F T T F right side of the equivalency.
F F F T
97
De Morgan’s Law (cont.)
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T F F
T F T F F
F T T F T
F F F T T
98
De Morgan’s Law (cont.)
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
99
De Morgan’s Law (cont.)
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
100
De Morgan’s Law (cont.)
p q (p ∨ q) ~(p ∨ q) ~p ~q ~p ∧ ~q
T T T F F F F
T F T F F T F
F T T F T F F
F F F T T T T
102
103
Lecture Problems
Are the following statements logically equivalent?
(p → q) → r and p → (q → r)
a) Yes
b) No
104
Lecture Problems
Are the following statements logically equivalent?
(p → q) → r and p → (q → r)
b) No
105
Lecture Problems
Are the following statements logically equivalent?
(p ∧ q) → r and (p → r) ∧ (q → r)
a) Yes
b) No
106
Lecture Problems
Are the following statements logically equivalent?
(p ∧ q) → r and (p → r) ∧ (q → r)
b) No
107
Laws of Propositional
Logic
108
Logical Equivalency Laws
▶ For the exams, you will be provided with the list of laws
▶ So, no need to memorize them, but you need to
understand them.
109
Summary of Logical
Equivalencies
110
Example
▶ Solution:
▶ Use the laws of logical equivalency to replace sections of
the statement form on the left with logically equivalent
expressions.
111
Example (cont.)
112
Example (cont.)
113
Example (cont.)
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
114
Example (cont.)
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
𝑝 ∨ (𝑞 ∧ ~𝑞) Commutative
115
Example (cont.)
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
𝑝 ∨ (𝑞 ∧ ~𝑞) Commutative
𝑝∨𝐹 Complement
116
Example (cont.)
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
𝑝 ∨ (𝑞 ∧ ~𝑞) Commutative
𝑝∨𝐹 Complement
𝑝 Identity
117
Example (cont.)
This is the final step, which
verifies the equivalency.
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
𝑝 ∨ (𝑞 ∧ ~𝑞) Commutative
𝑝∨𝐹 Complement
𝑝 Identity
118
Example (cont.)
On your exercises, you will
need to specify which law
you are applying.
▶ Verify the logical equivalence
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
𝑝 ∨ (𝑞 ∧ ~𝑞) Commutative
𝑝∨𝐹 Complement
𝑝 Identity
119
Example (cont.)
Make sure you use
one law per line.
▶ Verify the logical equivalence
𝑝 ∨ (~𝑞 ∧ 𝑞) Distributive
𝑝 ∨ (𝑞 ∧ ~𝑞) Commutative
𝑝∨𝐹 Complement
𝑝 Identity
120
Tautologies and
Contradictions
▶ Tautology
▶ A compound proposition that is always TRUE, no
matter what the truth values of the propositions
are.
▶ Contradiction
▶ A compound proposition that is always FALSE, no
matter what the truth values of the propositions
are.
121
Lecture Problems
Are the following statements logically equivalent?
Prove your answer by using the laws of
propositional logic.
a) Yes
b) No
122
Lecture Problems
Are the following statements logically equivalent?
Prove your answer by using the laws of
propositional logic.
a) Yes
123
Lecture Problems
Are the following statements logically equivalent?
Prove your answer by using the laws of
propositional logic.
~p → ~ q ≡ q → p
a) Yes
b) No
124
Lecture Problems
Are the following statements logically equivalent?
Prove your answer by using the laws of
propositional logic.
~p → ~ q ≡ q → p
a)Yes
125
Lecture Problems
Is the following conditional statements is a
tautology or a contradiction? Prove your answers
using the laws of propositional logic
p → (p ∨ q)
a) Tautology
b) Contradiction
126
Lecture Problems
Is the following conditional statements is a
tautology or a contradiction? Prove your answers
using the laws of propositional logic
p → (p ∨ q)
a) Tautology
127
Propositional Logic (end)
128