You are on page 1of 137

Course Introduction

Course name: Discrete Mathematics (MAD101)

Textbook: Discrete Mathematics and its applications, 8th edition, K.


Rosen

Topics covered:

Chapter 1: Logic and Proofs


Chapter 2: Sets, Functions, Sequences, and Sums
Chapter 3: Algorithms and the Integers
Chapter 5: Induction and Recursion
Chapter 6: Counting
Chapter 8: Advanced Counting Techniques
Chapter 10: Graphs
Chapter 11: Trees
ThienNV (FPTU) Chapter 1. Logic and Proofs 1/1
Chapter 1. Logic and Proofs

ThienNV (FPTU) Chapter 1. Logic and Proofs 2/1


Chapter 1. Logic and Proofs

ThienNV (FPTU) Chapter 1. Logic and Proofs 3/1


1.1 Propositional Logic

Definition
A proposition is a declarative sentence that is either true or false.

Example
Which of the following sentences are propositions?
a. Good job!
b. Hanoi is the capital of Vietnam.
c. What time is it?
d. It is now 8am.
e. 1+7=9.
f. x = 2021.

ThienNV (FPTU) Chapter 1. Logic and Proofs 4/1


1.1 Propositional Logic

Definition
A proposition is a declarative sentence that is either true or false.

Example
Which of the following sentences are propositions?
a. Good job!
b. Hanoi is the capital of Vietnam.
c. What time is it?
d. It is now 8am.
e. 1+7=9.
f. x = 2021.

Answer: b, d, e.

ThienNV (FPTU) Chapter 1. Logic and Proofs 4/1


1.1 Propositional Logic

Definition
A proposition is a declarative sentence that is either true or false.

Example
Which of the following sentences are propositions?
a. Good job!
b. Hanoi is the capital of Vietnam.
c. What time is it?
d. It is now 8am.
e. 1+7=9.
f. x = 2021.

Answer: b, d, e.

ThienNV (FPTU) Chapter 1. Logic and Proofs 4/1


Compound Propositions

Let p be a proposition.
Definition
Negation ¬p = proposition that is true if p is false, and is false if p is true.

p ¬p
1 0
0 1

Example
If p = ”Today is not Monday”, then ¬p = ”Today is Monday”.

Note. 1 =True, 0 = False.

ThienNV (FPTU) Chapter 1. Logic and Proofs 5/1


Compound Propositions
Let p, q be propositions.
Definition
Conjunction p ∧ q = ”p and q” proposition that is true when both p and q
are true, and is false otherwise.
p q p∧q
1 1 1
1 0 0
0 1 0
0 0 0

Example
Let p be the proposition ”Nam is a FPT student” and q be the proposition
”Nam is clever”. Then

p ∧ q = ”Nam is a FPT student and clever”.


ThienNV (FPTU) Chapter 1. Logic and Proofs 6/1
Definition
Disjunction p ∨ q = ”p or q”: proposition that is false when both p and q
are false, and is true otherwise.
p q p∨q
1 1 1
1 0 1
0 1 1
0 0 0

Example
Let p be the proposition ”Nam is a FPT student” and q be the proposition
”An is clever”. Then

p ∨ q = ”Either Nam is a FPT student or An is clever”.

ThienNV (FPTU) Chapter 1. Logic and Proofs 7/1


Definition
Exclusive or p ⊕ q = ”only p or only q”: proposition that is true when
exactly one of p and q is true and is false otherwise.

p q p⊕q
1 1 0
1 0 1
0 1 1
0 0 0

Example
”The window is open or the window is closed.” is a logical operation
exclusive or.

ThienNV (FPTU) Chapter 1. Logic and Proofs 8/1


Definition
p q p→q
Conditional statement p → q = 1 1 1
proposition that is false when p is true 1 0 0
and q is false, and is true otherwise. 0 1 1
0 0 1
Several ways express p → q:
If p then q
q if p
p is sufficient for q
q is a necessary condition for p
p only if q

Example
p =”You pass this class”, q =”You miss more than 20% of lectures”.
”You can not pass this class if you miss more than 20% of lectures.”=
q → ¬p.
ThienNV (FPTU) Chapter 1. Logic and Proofs 9/1
Definition
p q p→q
Conditional statement p → q = 1 1 1
proposition that is false when p is true 1 0 0
and q is false, and is true otherwise. 0 1 1
0 0 1
Several ways express p → q:
If p then q
q if p
p is sufficient for q
q is a necessary condition for p
p only if q

Example
p =”You pass this class”, q =”You miss more than 20% of lectures”.
”You can not pass this class if you miss more than 20% of lectures.”=
q → ¬p.
ThienNV (FPTU) Chapter 1. Logic and Proofs 9/1
Definition
p q p↔q
Biconditional statement p ↔ q = 1 1 1
proposition that is true when p and
1 0 0
q have the same truth values, and is
0 1 0
false otherwise.
0 0 1

Example
Translate the sentence ”I watch soccer if and only if Manchester United
plays or I have no homework.” if
p = ”I watch soccer”,
q = ”Manchester United plays”,
r = ”I have no homework”.
Answer: p ↔ (q ∨ r ).

ThienNV (FPTU) Chapter 1. Logic and Proofs 10 / 1


Logic and Bit Operations
Computers represent information using bits. A bit is a symbol of two
possible values, 0 and 1. A bit can represent a truth value, that is, 1
represents True and 0 represents False. Information is often represented
using bit strings, and operations on bit strings can be used to manipulate
this information.

NOT = ¬: ¬1 = 0, ¬0 = 1.
AND = ∧: 1 ∧ 1 = 1, 1 ∧ 0 = 0 ∧ 1 = 0 ∧ 0 = 0.
OR = ∨: 1 ∨ 1 = 1 ∨ 0 = 0 ∨ 1 = 1, 0 ∨ 0 = 0.
XOR = ⊕: 1 ⊕ 1 = 0 ⊕ 0 = 0, 1 ⊕ 0 = 0 ⊕ 1 = 1.

Example

¬11100 ∧ 01001 = 00011 ∧ 01001 = 00001


(110101 ⊕ 011011) ∨ 110010 = 101110 ∨ 110010 = 111110.

ThienNV (FPTU) Chapter 1. Logic and Proofs 11 / 1


Logic and Bit Operations
Computers represent information using bits. A bit is a symbol of two
possible values, 0 and 1. A bit can represent a truth value, that is, 1
represents True and 0 represents False. Information is often represented
using bit strings, and operations on bit strings can be used to manipulate
this information.

NOT = ¬: ¬1 = 0, ¬0 = 1.
AND = ∧: 1 ∧ 1 = 1, 1 ∧ 0 = 0 ∧ 1 = 0 ∧ 0 = 0.
OR = ∨: 1 ∨ 1 = 1 ∨ 0 = 0 ∨ 1 = 1, 0 ∨ 0 = 0.
XOR = ⊕: 1 ⊕ 1 = 0 ⊕ 0 = 0, 1 ⊕ 0 = 0 ⊕ 1 = 1.

Example

¬11100 ∧ 01001 = 00011 ∧ 01001 = 00001


(110101 ⊕ 011011) ∨ 110010 = 101110 ∨ 110010 = 111110.

ThienNV (FPTU) Chapter 1. Logic and Proofs 11 / 1


1.3 Propositional Equivalences

Definition
A compound proposition is called a
tautology if it is always true regardless of the truth values of the
propositions that occur in it.
contradiction if it is always false.
contingency if it is neither tautology nor contradiction.
Two compound propositions p and q are logically equivalent if the
biconditional statement p ↔ q is a tautology, denoted by p ≡ q.

Two methods for proving logical equivalences:

Use truth table


Use other logical equivalences.

ThienNV (FPTU) Chapter 1. Logic and Proofs 12 / 1


Example
p ∨ ¬p is a tautology.
p ∧ ¬p is a contradiction.
p → q is logically equivalent to ¬p ∨ q.

p q ¬p p→q ¬p ∨ q
1 1 0 1 1

ThienNV (FPTU) Chapter 1. Logic and Proofs 13 / 1


Example
p ∨ ¬p is a tautology.
p ∧ ¬p is a contradiction.
p → q is logically equivalent to ¬p ∨ q.

p q ¬p p→q ¬p ∨ q
1 1 0 1 1
1 0 0 0 0

ThienNV (FPTU) Chapter 1. Logic and Proofs 13 / 1


Example
p ∨ ¬p is a tautology.
p ∧ ¬p is a contradiction.
p → q is logically equivalent to ¬p ∨ q.

p q ¬p p→q ¬p ∨ q
1 1 0 1 1
1 0 0 0 0
0 1 1 1 1

ThienNV (FPTU) Chapter 1. Logic and Proofs 13 / 1


Example
p ∨ ¬p is a tautology.
p ∧ ¬p is a contradiction.
p → q is logically equivalent to ¬p ∨ q.

p q ¬p p→q ¬p ∨ q
1 1 0 1 1
1 0 0 0 0
0 1 1 1 1
0 0 1 1 1

ThienNV (FPTU) Chapter 1. Logic and Proofs 13 / 1


Example
p ∨ ¬p is a tautology.
p ∧ ¬p is a contradiction.
p → q is logically equivalent to ¬p ∨ q.

p q ¬p p→q ¬p ∨ q
1 1 0 1 1
1 0 0 0 0
0 1 1 1 1
0 0 1 1 1

ThienNV (FPTU) Chapter 1. Logic and Proofs 13 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0
Idempotent laws p∧p ≡p∨p ≡p

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0
Idempotent laws p∧p ≡p∨p ≡p
Commutative laws p∧q ≡q∧p
p∨q ≡q∨p

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0
Idempotent laws p∧p ≡p∨p ≡p
Commutative laws p∧q ≡q∧p
p∨q ≡q∨p
Associative laws p ∧ (q ∧ r ) ≡ (p ∧ q) ∧ r
p ∨ (q ∨ r ) ≡ (p ∨ q) ∨ r

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0
Idempotent laws p∧p ≡p∨p ≡p
Commutative laws p∧q ≡q∧p
p∨q ≡q∨p
Associative laws p ∧ (q ∧ r ) ≡ (p ∧ q) ∧ r
p ∨ (q ∨ r ) ≡ (p ∨ q) ∨ r
Distributive laws p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r )
p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r )

ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1


Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0
Idempotent laws p∧p ≡p∨p ≡p
Commutative laws p∧q ≡q∧p
p∨q ≡q∨p
Associative laws p ∧ (q ∧ r ) ≡ (p ∧ q) ∧ r
p ∨ (q ∨ r ) ≡ (p ∨ q) ∨ r
Distributive laws p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r )
p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r )
De Morgan’s laws ¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1
Some logical equivalences
Double negation law ¬(¬p) ≡ p
Identity laws p∧1≡p
p∨0≡p
Domination laws p∨1≡1
p∧0≡0
Negation laws p ∨ ¬p ≡ 1
p ∧ ¬p ≡ 0
Idempotent laws p∧p ≡p∨p ≡p
Commutative laws p∧q ≡q∧p
p∨q ≡q∨p
Associative laws p ∧ (q ∧ r ) ≡ (p ∧ q) ∧ r
p ∨ (q ∨ r ) ≡ (p ∨ q) ∨ r
Distributive laws p ∧ (q ∨ r ) ≡ (p ∧ q) ∨ (p ∧ r )
p ∨ (q ∧ r ) ≡ (p ∨ q) ∧ (p ∨ r )
De Morgan’s laws ¬(p ∧ q) ≡ ¬p ∨ ¬q
¬(p ∨ q) ≡ ¬p ∧ ¬q
ThienNV (FPTU) Chapter 1. Logic and Proofs 14 / 1
Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))

We have

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]

We have

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]
≡ ¬p ∧ [¬(¬p) ∨ ¬q]
We have

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]
≡ ¬p ∧ [¬(¬p) ∨ ¬q]
We have ≡ ¬p ∧ (p ∨ ¬q)

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]
≡ ¬p ∧ [¬(¬p) ∨ ¬q]
We have ≡ ¬p ∧ (p ∨ ¬q)
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q)

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]
≡ ¬p ∧ [¬(¬p) ∨ ¬q]
We have ≡ ¬p ∧ (p ∨ ¬q)
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q)
≡ 0 ∨ (¬p ∧ ¬q)

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]
≡ ¬p ∧ [¬(¬p) ∨ ¬q]
We have ≡ ¬p ∧ (p ∨ ¬q)
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q)
≡ 0 ∨ (¬p ∧ ¬q)
≡ (¬p ∧ ¬q).

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Some logical equivalences

p → q ≡ ¬p ∨ q
p ↔ q ≡ (p → q) ∧ (q → p)
p ⊕ q ≡ ¬(p ↔ q)
¬(p ↔ q) ≡ ¬p ↔ q ≡ p ↔ ¬q

Example
Show that ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q.
¬(p ∨ (¬p ∧ q))
≡ ¬p ∧ [¬(¬p ∧ q)]
≡ ¬p ∧ [¬(¬p) ∨ ¬q]
We have ≡ ¬p ∧ (p ∨ ¬q)
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q)
≡ 0 ∨ (¬p ∧ ¬q)
≡ (¬p ∧ ¬q).

ThienNV (FPTU) Chapter 1. Logic and Proofs 15 / 1


Example
Show that p → (p ∨ q) is a tautology.
We have
p → (p ∨ q)
≡ ¬p ∨ (p ∨ q)

ThienNV (FPTU) Chapter 1. Logic and Proofs 16 / 1


Example
Show that p → (p ∨ q) is a tautology.
We have
p → (p ∨ q)
≡ ¬p ∨ (p ∨ q)
≡ (¬p ∨ p) ∨ q

ThienNV (FPTU) Chapter 1. Logic and Proofs 16 / 1


Example
Show that p → (p ∨ q) is a tautology.
We have
p → (p ∨ q)
≡ ¬p ∨ (p ∨ q)
≡ (¬p ∨ p) ∨ q
≡ 1∨q

ThienNV (FPTU) Chapter 1. Logic and Proofs 16 / 1


Example
Show that p → (p ∨ q) is a tautology.
We have
p → (p ∨ q)
≡ ¬p ∨ (p ∨ q)
≡ (¬p ∨ p) ∨ q
≡ 1∨q
≡ 1.

ThienNV (FPTU) Chapter 1. Logic and Proofs 16 / 1


Example
Show that p → (p ∨ q) is a tautology.
We have
p → (p ∨ q)
≡ ¬p ∨ (p ∨ q)
≡ (¬p ∨ p) ∨ q
≡ 1∨q
≡ 1.

ThienNV (FPTU) Chapter 1. Logic and Proofs 16 / 1


Example
Show that (p → r ) ∧ (q → r ) and (p ∨ q) → r are logically equivalent.
We have
(p → r ) ∧ (q → r )

ThienNV (FPTU) Chapter 1. Logic and Proofs 17 / 1


Example
Show that (p → r ) ∧ (q → r ) and (p ∨ q) → r are logically equivalent.
We have
(p → r ) ∧ (q → r )
≡ (¬p ∨ r ) ∧ (¬q ∨ r )

ThienNV (FPTU) Chapter 1. Logic and Proofs 17 / 1


Example
Show that (p → r ) ∧ (q → r ) and (p ∨ q) → r are logically equivalent.
We have
(p → r ) ∧ (q → r )
≡ (¬p ∨ r ) ∧ (¬q ∨ r )
≡ (¬p ∧ ¬q) ∨ r

ThienNV (FPTU) Chapter 1. Logic and Proofs 17 / 1


Example
Show that (p → r ) ∧ (q → r ) and (p ∨ q) → r are logically equivalent.
We have
(p → r ) ∧ (q → r )
≡ (¬p ∨ r ) ∧ (¬q ∨ r )
≡ (¬p ∧ ¬q) ∨ r
≡ ¬(p ∨ q) ∨ r

ThienNV (FPTU) Chapter 1. Logic and Proofs 17 / 1


Example
Show that (p → r ) ∧ (q → r ) and (p ∨ q) → r are logically equivalent.
We have
(p → r ) ∧ (q → r )
≡ (¬p ∨ r ) ∧ (¬q ∨ r )
≡ (¬p ∧ ¬q) ∨ r
≡ ¬(p ∨ q) ∨ r
≡ (p ∨ q) → r .

ThienNV (FPTU) Chapter 1. Logic and Proofs 17 / 1


Example
Show that (p → r ) ∧ (q → r ) and (p ∨ q) → r are logically equivalent.
We have
(p → r ) ∧ (q → r )
≡ (¬p ∨ r ) ∧ (¬q ∨ r )
≡ (¬p ∧ ¬q) ∨ r
≡ ¬(p ∨ q) ∨ r
≡ (p ∨ q) → r .

ThienNV (FPTU) Chapter 1. Logic and Proofs 17 / 1


1.4 Predicates and Quantifiers

The statement ”x < 2021” is not a proposition. It will become a


proposition when a value is assigned to x .

The statement ”x < 2021” is called a propositional function, denoted by


P(x ). Then:
P(0) = 1, P(2025) = 0.

ThienNV (FPTU) Chapter 1. Logic and Proofs 18 / 1


1.4 Predicates and Quantifiers

The statement ”x < 2021” is not a proposition. It will become a


proposition when a value is assigned to x .

The statement ”x < 2021” is called a propositional function, denoted by


P(x ). Then:
P(0) = 1, P(2025) = 0.
x is called a variable, ”< 2021” is the predicate.

ThienNV (FPTU) Chapter 1. Logic and Proofs 18 / 1


1.4 Predicates and Quantifiers

The statement ”x < 2021” is not a proposition. It will become a


proposition when a value is assigned to x .

The statement ”x < 2021” is called a propositional function, denoted by


P(x ). Then:
P(0) = 1, P(2025) = 0.
x is called a variable, ”< 2021” is the predicate.

A propositional function can be multi-variable.


Example
Q(x , y ) = ”x + y = 8” is a propositional function with variables x , y and
Q is the predicate.

ThienNV (FPTU) Chapter 1. Logic and Proofs 18 / 1


1.4 Predicates and Quantifiers

The statement ”x < 2021” is not a proposition. It will become a


proposition when a value is assigned to x .

The statement ”x < 2021” is called a propositional function, denoted by


P(x ). Then:
P(0) = 1, P(2025) = 0.
x is called a variable, ”< 2021” is the predicate.

A propositional function can be multi-variable.


Example
Q(x , y ) = ”x + y = 8” is a propositional function with variables x , y and
Q is the predicate.

ThienNV (FPTU) Chapter 1. Logic and Proofs 18 / 1


Quantifiers: ∀, ∃
Definition
Let P(x ) be a propositional function where x gets values in a particular
domain.
The universal quantification ∀xP(x ) = For all values of x in the domain,
P(x ) is true.
The existential quantification ∃xP(x ) = There is at least a value of x in
the domain such that P(x ) is true.

Example
Let x represent an integer. Determine the truth value of the following
propositions
a. ∀x ((x ≥ 0) → (x 2 ≥ 0)) is True.
b. ∀x ((x ≥ 0) ↔ (x 2 ≥ 0))

ThienNV (FPTU) Chapter 1. Logic and Proofs 19 / 1


Quantifiers: ∀, ∃
Definition
Let P(x ) be a propositional function where x gets values in a particular
domain.
The universal quantification ∀xP(x ) = For all values of x in the domain,
P(x ) is true.
The existential quantification ∃xP(x ) = There is at least a value of x in
the domain such that P(x ) is true.

Example
Let x represent an integer. Determine the truth value of the following
propositions
a. ∀x ((x ≥ 0) → (x 2 ≥ 0)) is True.
b. ∀x ((x ≥ 0) ↔ (x 2 ≥ 0)) is False.
c. ∃x (x 2 = 16)

ThienNV (FPTU) Chapter 1. Logic and Proofs 19 / 1


Quantifiers: ∀, ∃
Definition
Let P(x ) be a propositional function where x gets values in a particular
domain.
The universal quantification ∀xP(x ) = For all values of x in the domain,
P(x ) is true.
The existential quantification ∃xP(x ) = There is at least a value of x in
the domain such that P(x ) is true.

Example
Let x represent an integer. Determine the truth value of the following
propositions
a. ∀x ((x ≥ 0) → (x 2 ≥ 0)) is True.
b. ∀x ((x ≥ 0) ↔ (x 2 ≥ 0)) is False.
c. ∃x (x 2 = 16) is True.
d. ∃x (x 3 = 16)
ThienNV (FPTU) Chapter 1. Logic and Proofs 19 / 1
Quantifiers: ∀, ∃
Definition
Let P(x ) be a propositional function where x gets values in a particular
domain.
The universal quantification ∀xP(x ) = For all values of x in the domain,
P(x ) is true.
The existential quantification ∃xP(x ) = There is at least a value of x in
the domain such that P(x ) is true.

Example
Let x represent an integer. Determine the truth value of the following
propositions
a. ∀x ((x ≥ 0) → (x 2 ≥ 0)) is True.
b. ∀x ((x ≥ 0) ↔ (x 2 ≥ 0)) is False.
c. ∃x (x 2 = 16) is True.
d. ∃x (x 3 = 16) is False.
ThienNV
2 (FPTU) Chapter 1. Logic and Proofs 19 / 1
Quantifiers: ∀, ∃
Definition
Let P(x ) be a propositional function where x gets values in a particular
domain.
The universal quantification ∀xP(x ) = For all values of x in the domain,
P(x ) is true.
The existential quantification ∃xP(x ) = There is at least a value of x in
the domain such that P(x ) is true.

Example
Let x represent an integer. Determine the truth value of the following
propositions
a. ∀x ((x ≥ 0) → (x 2 ≥ 0)) is True.
b. ∀x ((x ≥ 0) ↔ (x 2 ≥ 0)) is False.
c. ∃x (x 2 = 16) is True.
d. ∃x (x 3 = 16) is False.
ThienNV
2 (FPTU) Chapter 1. Logic and Proofs 19 / 1
Quantifiers: ∀, ∃
Definition
Let P(x ) be a propositional function where x gets values in a particular
domain.
The universal quantification ∀xP(x ) = For all values of x in the domain,
P(x ) is true.
The existential quantification ∃xP(x ) = There is at least a value of x in
the domain such that P(x ) is true.

Example
Let x represent an integer. Determine the truth value of the following
propositions
a. ∀x ((x ≥ 0) → (x 2 ≥ 0)) is True.
b. ∀x ((x ≥ 0) ↔ (x 2 ≥ 0)) is False.
c. ∃x (x 2 = 16) is True.
d. ∃x (x 3 = 16) is False.
ThienNV
2 (FPTU) Chapter 1. Logic and Proofs 19 / 1
Example
Let x represent a real number. Determine the truth value of the following
propositions
a. ∀x (|x | > 0)
b. ∀x (x 2 ≥ x )
c. ∀x ((x 2 > 0) ∨ (x = 0))
d. ∃x ((x > 0) ∧ (x 2 < x ))
e. ∃x ((x > 2) ⊕ (x 2 > 3))

Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 20 / 1


Example
Let x represent a real number. Determine the truth value of the following
propositions
a. ∀x (|x | > 0)
b. ∀x (x 2 ≥ x )
c. ∀x ((x 2 > 0) ∨ (x = 0))
d. ∃x ((x > 0) ∧ (x 2 < x ))
e. ∃x ((x > 2) ⊕ (x 2 > 3))

Answer: Only c, d, e are True.

ThienNV (FPTU) Chapter 1. Logic and Proofs 20 / 1


Example
Let x represent a real number. Determine the truth value of the following
propositions
a. ∀x (|x | > 0)
b. ∀x (x 2 ≥ x )
c. ∀x ((x 2 > 0) ∨ (x = 0))
d. ∃x ((x > 0) ∧ (x 2 < x ))
e. ∃x ((x > 2) ⊕ (x 2 > 3))

Answer: Only c, d, e are True.

ThienNV (FPTU) Chapter 1. Logic and Proofs 20 / 1


Relation between quantifiers and proposition

Suppose that the domain is a set S = {a1 , a2 , · · · , an }. Then

∀xP(x ) ≡ P(a1 ) ∧ P(a2 ) ∧ · · · ∧ P(an )


∃xP(x )

ThienNV (FPTU) Chapter 1. Logic and Proofs 21 / 1


Relation between quantifiers and proposition

Suppose that the domain is a set S = {a1 , a2 , · · · , an }. Then

∀xP(x ) ≡ P(a1 ) ∧ P(a2 ) ∧ · · · ∧ P(an )


∃xP(x ) ≡ P(a1 ) ∨ P(a2 ) ∨ · · · ∨ P(an ).

Example
Let P(x ) be a propositional function with domain {0, 1, 2}. Then

∀xP(x ) ≡ P(0) ∧ P(1) ∧ P(2)


∃x ((x > 0) ∧ P(x )) ≡ P(1) ∨ P(2)
∃x (P(x ) ∧ ∀x ((x ≤ 1) → ¬P(x )) ≡ ¬P(0) ∧ ¬P(1) ∧ P(2).

ThienNV (FPTU) Chapter 1. Logic and Proofs 21 / 1


Relation between quantifiers and proposition

Suppose that the domain is a set S = {a1 , a2 , · · · , an }. Then

∀xP(x ) ≡ P(a1 ) ∧ P(a2 ) ∧ · · · ∧ P(an )


∃xP(x ) ≡ P(a1 ) ∨ P(a2 ) ∨ · · · ∨ P(an ).

Example
Let P(x ) be a propositional function with domain {0, 1, 2}. Then

∀xP(x ) ≡ P(0) ∧ P(1) ∧ P(2)


∃x ((x > 0) ∧ P(x )) ≡ P(1) ∨ P(2)
∃x (P(x ) ∧ ∀x ((x ≤ 1) → ¬P(x )) ≡ ¬P(0) ∧ ¬P(1) ∧ P(2).

ThienNV (FPTU) Chapter 1. Logic and Proofs 21 / 1


Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

ThienNV (FPTU) Chapter 1. Logic and Proofs 22 / 1


Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

Example
Rewrite the expression ¬∃x (P(x ) → Q(x )) so that the negation precedes
the predicates.

ThienNV (FPTU) Chapter 1. Logic and Proofs 22 / 1


Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

Example
Rewrite the expression ¬∃x (P(x ) → Q(x )) so that the negation precedes
the predicates.
Answer:

¬∃x (P(x ) → Q(x )) ≡ ¬∃x (¬P(x ) ∨ Q(x ))


≡∀x ¬(¬P(x ) ∨ Q(x ))
≡∀x [(¬¬P(x )) ∧ ¬Q(x )]
≡∀x (P(x ) ∧ ¬Q(x )).
Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

Example
Rewrite the expression ¬∃x (P(x ) → Q(x )) so that the negation precedes
the predicates.
Answer:

¬∃x (P(x ) → Q(x )) ≡ ¬∃x (¬P(x ) ∨ Q(x ))

≡∀x [(¬¬P(x )) ∧ ¬Q(x )]


≡∀x (P(x ) ∧ ¬Q(x )).
Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

Example
Rewrite the expression ¬∃x (P(x ) → Q(x )) so that the negation precedes
the predicates.
Answer:

¬∃x (P(x ) → Q(x )) ≡ ¬∃x (¬P(x ) ∨ Q(x ))

≡∀x (P(x ) ∧ ¬Q(x )).


Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

Example
Rewrite the expression ¬∃x (P(x ) → Q(x )) so that the negation precedes
the predicates.
Answer:

¬∃x (P(x ) → Q(x )) ≡ ¬∃x (¬P(x ) ∨ Q(x ))


≡∀x ¬(¬P(x ) ∨ Q(x ))
≡∀x [(¬¬P(x )) ∧ ¬Q(x )]
≡∀x (P(x ) ∧ ¬Q(x )).
ThienNV (FPTU) Chapter 1. Logic and Proofs 22 / 1
Negation
¬∀xP(x ) ≡ ∃x ¬P(x )
¬∃xP(x ) ≡ ∀x ¬P(x )
Example
The negation of ”Every student in class SE1401 has studied MAE101” is
”There is a student in class SE1401 has not studied MAE101 yet”.

Example
Rewrite the expression ¬∃x (P(x ) → Q(x )) so that the negation precedes
the predicates.
Answer:

¬∃x (P(x ) → Q(x )) ≡ ¬∃x (¬P(x ) ∨ Q(x ))


≡∀x ¬(¬P(x ) ∨ Q(x ))
≡∀x [(¬¬P(x )) ∧ ¬Q(x )]
≡∀x (P(x ) ∧ ¬Q(x )).
ThienNV (FPTU) Chapter 1. Logic and Proofs 22 / 1
Translating Sentences into Logical Expressions

Example
Translate ”Someone in your class can speak French.” into logical
expression.
(a) If domain consists of all students in your class.

ThienNV (FPTU) Chapter 1. Logic and Proofs 23 / 1


Translating Sentences into Logical Expressions

Example
Translate ”Someone in your class can speak French.” into logical
expression.
(a) If domain consists of all students in your class.
Put P(x ) = ”x speaks French”. Then

ThienNV (FPTU) Chapter 1. Logic and Proofs 23 / 1


Translating Sentences into Logical Expressions

Example
Translate ”Someone in your class can speak French.” into logical
expression.
(a) If domain consists of all students in your class.
Put P(x ) = ”x speaks French”. Then
”Someone in your class can speak French.” ≡ ∃xP(x ).
(b) If domain consist of all students in FPTU.

ThienNV (FPTU) Chapter 1. Logic and Proofs 23 / 1


Translating Sentences into Logical Expressions

Example
Translate ”Someone in your class can speak French.” into logical
expression.
(a) If domain consists of all students in your class.
Put P(x ) = ”x speaks French”. Then
”Someone in your class can speak French.” ≡ ∃xP(x ).
(b) If domain consist of all students in FPTU.
Put P(x ) = ”x speaks French”, Q(x ) = ”x is a member in your class”.
Then

ThienNV (FPTU) Chapter 1. Logic and Proofs 23 / 1


Translating Sentences into Logical Expressions

Example
Translate ”Someone in your class can speak French.” into logical
expression.
(a) If domain consists of all students in your class.
Put P(x ) = ”x speaks French”. Then
”Someone in your class can speak French.” ≡ ∃xP(x ).
(b) If domain consist of all students in FPTU.
Put P(x ) = ”x speaks French”, Q(x ) = ”x is a member in your class”.
Then
”Someone in your class can speak French.” ≡ ∃x (Q(x ) ∧ P(x )).

ThienNV (FPTU) Chapter 1. Logic and Proofs 23 / 1


Translating Sentences into Logical Expressions

Example
Translate ”Someone in your class can speak French.” into logical
expression.
(a) If domain consists of all students in your class.
Put P(x ) = ”x speaks French”. Then
”Someone in your class can speak French.” ≡ ∃xP(x ).
(b) If domain consist of all students in FPTU.
Put P(x ) = ”x speaks French”, Q(x ) = ”x is a member in your class”.
Then
”Someone in your class can speak French.” ≡ ∃x (Q(x ) ∧ P(x )).

ThienNV (FPTU) Chapter 1. Logic and Proofs 23 / 1


Example
Translate the sentence ”Each student of SE1401 has visited Laos or
Thailand.” into a logical expression provided that the domain is all students
of SE1401, P(x ) = ”x has visited Laos”, Q(x ) = ”x has visited Thailand”.
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 24 / 1


Example
Translate the sentence ”Each student of SE1401 has visited Laos or
Thailand.” into a logical expression provided that the domain is all students
of SE1401, P(x ) = ”x has visited Laos”, Q(x ) = ”x has visited Thailand”.
Answer:∀x (P(x ) ∨ Q(x )).

Example
Translate the sentence ”Any student who is planning a trip to Japan will
takes Japanese course” into a logical expression provided that the domain
is the set of all students, P(x ) = ”x is planning a trip to Japan”, Q(x ) =
”x will takes Japanese course”.

ThienNV (FPTU) Chapter 1. Logic and Proofs 24 / 1


Example
Translate the sentence ”Each student of SE1401 has visited Laos or
Thailand.” into a logical expression provided that the domain is all students
of SE1401, P(x ) = ”x has visited Laos”, Q(x ) = ”x has visited Thailand”.
Answer:∀x (P(x ) ∨ Q(x )).

Example
Translate the sentence ”Any student who is planning a trip to Japan will
takes Japanese course” into a logical expression provided that the domain
is the set of all students, P(x ) = ”x is planning a trip to Japan”, Q(x ) =
”x will takes Japanese course”.
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 24 / 1


Example
Translate the sentence ”Each student of SE1401 has visited Laos or
Thailand.” into a logical expression provided that the domain is all students
of SE1401, P(x ) = ”x has visited Laos”, Q(x ) = ”x has visited Thailand”.
Answer:∀x (P(x ) ∨ Q(x )).

Example
Translate the sentence ”Any student who is planning a trip to Japan will
takes Japanese course” into a logical expression provided that the domain
is the set of all students, P(x ) = ”x is planning a trip to Japan”, Q(x ) =
”x will takes Japanese course”.
Answer:∀x (P(x ) → Q(x )).

ThienNV (FPTU) Chapter 1. Logic and Proofs 24 / 1


Example
Translate the sentence ”Each student of SE1401 has visited Laos or
Thailand.” into a logical expression provided that the domain is all students
of SE1401, P(x ) = ”x has visited Laos”, Q(x ) = ”x has visited Thailand”.
Answer:∀x (P(x ) ∨ Q(x )).

Example
Translate the sentence ”Any student who is planning a trip to Japan will
takes Japanese course” into a logical expression provided that the domain
is the set of all students, P(x ) = ”x is planning a trip to Japan”, Q(x ) =
”x will takes Japanese course”.
Answer:∀x (P(x ) → Q(x )).

ThienNV (FPTU) Chapter 1. Logic and Proofs 24 / 1


1.5 Nested Quantifiers

∀x ∀yP(x , y ) = For all x and for all y , P(x , y ) is true


∀x ∃yP(x , y ) = For all x there is y such that P(x , y ) is true

ThienNV (FPTU) Chapter 1. Logic and Proofs 25 / 1


1.5 Nested Quantifiers

∀x ∀yP(x , y ) = For all x and for all y , P(x , y ) is true


∀x ∃yP(x , y ) = For all x there is y such that P(x , y ) is true
∃x ∀yP(x , y ) = There exists x such that for all y , P(x , y ) is true

ThienNV (FPTU) Chapter 1. Logic and Proofs 25 / 1


1.5 Nested Quantifiers

∀x ∀yP(x , y ) = For all x and for all y , P(x , y ) is true


∀x ∃yP(x , y ) = For all x there is y such that P(x , y ) is true
∃x ∀yP(x , y ) = There exists x such that for all y , P(x , y ) is true
∃x ∃yP(x , y ) = There exist x and y such that P(x , y ) is true.

ThienNV (FPTU) Chapter 1. Logic and Proofs 25 / 1


1.5 Nested Quantifiers

∀x ∀yP(x , y ) = For all x and for all y , P(x , y ) is true


∀x ∃yP(x , y ) = For all x there is y such that P(x , y ) is true
∃x ∀yP(x , y ) = There exists x such that for all y , P(x , y ) is true
∃x ∃yP(x , y ) = There exist x and y such that P(x , y ) is true.

Note. The order of the quantifiers is important!

∀x ∀yP(x , y ) ≡ ∀y ∀xP(x , y )
∃x ∃yP(x , y ) ≡ ∃y ∃xP(x , y )
∀x ∃yP(x , y ) 6≡ ∃y ∀xP(x , y )
∃x ∀yP(x , y ) 6≡ ∀y ∃xP(x , y ).

For example, P(x , y )= ”x has sent an email to y ”. Then


∃y ∀xP(x , y )= There is a person who has received emails from others.
∀x ∃yP(x , y )= Every people has sent at least an email to another.
ThienNV (FPTU) Chapter 1. Logic and Proofs 25 / 1
1.5 Nested Quantifiers

∀x ∀yP(x , y ) = For all x and for all y , P(x , y ) is true


∀x ∃yP(x , y ) = For all x there is y such that P(x , y ) is true
∃x ∀yP(x , y ) = There exists x such that for all y , P(x , y ) is true
∃x ∃yP(x , y ) = There exist x and y such that P(x , y ) is true.

Note. The order of the quantifiers is important!

∀x ∀yP(x , y ) ≡ ∀y ∀xP(x , y )
∃x ∃yP(x , y ) ≡ ∃y ∃xP(x , y )
∀x ∃yP(x , y ) 6≡ ∃y ∀xP(x , y )
∃x ∀yP(x , y ) 6≡ ∀y ∃xP(x , y ).

For example, P(x , y )= ”x has sent an email to y ”. Then


∃y ∀xP(x , y )= There is a person who has received emails from others.
∀x ∃yP(x , y )= Every people has sent at least an email to another.
ThienNV (FPTU) Chapter 1. Logic and Proofs 25 / 1
Example
Determine the truth values of the following propositions on the set of real
numbers.
a. ∀x ∀y (x + y = 2)
b. ∀x ∃y (x + y = 2)
c. ∃x ∀y (x + y = 2)
d. ∃x ∃y (x + y = 2)
e. ∃x ∃y (((x ≤ 0) ∧ (y ≤ 0)) ∧ (x − y > 0))
f. ∃x ∀y (y 6= 0 → xy = 1)
g. ∀x ∃y (x 6= 0 → xy = 1)
h. ∃x ∃y (x + 2y = 2 ∧ 2x + 4y = 5).
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 26 / 1


Example
Determine the truth values of the following propositions on the set of real
numbers.
a. ∀x ∀y (x + y = 2)
b. ∀x ∃y (x + y = 2)
c. ∃x ∀y (x + y = 2)
d. ∃x ∃y (x + y = 2)
e. ∃x ∃y (((x ≤ 0) ∧ (y ≤ 0)) ∧ (x − y > 0))
f. ∃x ∀y (y 6= 0 → xy = 1)
g. ∀x ∃y (x 6= 0 → xy = 1)
h. ∃x ∃y (x + 2y = 2 ∧ 2x + 4y = 5).
Answer: Only b, d, e, g are True.

ThienNV (FPTU) Chapter 1. Logic and Proofs 26 / 1


Example
Determine the truth values of the following propositions on the set of real
numbers.
a. ∀x ∀y (x + y = 2)
b. ∀x ∃y (x + y = 2)
c. ∃x ∀y (x + y = 2)
d. ∃x ∃y (x + y = 2)
e. ∃x ∃y (((x ≤ 0) ∧ (y ≤ 0)) ∧ (x − y > 0))
f. ∃x ∀y (y 6= 0 → xy = 1)
g. ∀x ∃y (x 6= 0 → xy = 1)
h. ∃x ∃y (x + 2y = 2 ∧ 2x + 4y = 5).
Answer: Only b, d, e, g are True.

ThienNV (FPTU) Chapter 1. Logic and Proofs 26 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

Example
Let L(x , y ) be the statement “x loves y ,” where the domain for both x
and y consists of all people in the world. Use quantifiers to express each of
these statements:

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

Example
Let L(x , y ) be the statement “x loves y ,” where the domain for both x
and y consists of all people in the world. Use quantifiers to express each of
these statements:
a. There is somebody whom everybody loves.

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

Example
Let L(x , y ) be the statement “x loves y ,” where the domain for both x
and y consists of all people in the world. Use quantifiers to express each of
these statements:
a. There is somebody whom everybody loves.∃x ∀yL(y , x )

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

Example
Let L(x , y ) be the statement “x loves y ,” where the domain for both x
and y consists of all people in the world. Use quantifiers to express each of
these statements:
a. There is somebody whom everybody loves.∃x ∀yL(y , x )
b. There are exactly two people whom An loves.

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

Example
Let L(x , y ) be the statement “x loves y ,” where the domain for both x
and y consists of all people in the world. Use quantifiers to express each of
these statements:
a. There is somebody whom everybody loves.∃x ∀yL(y , x )
b. There are exactly two people whom An loves.

∃x ∃y [x 6= y ∧ L(An, x ) ∧ L(An, y ) ∧ ∀z (x 6= z ∧ y 6= z → ¬L(An, z))]

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Translate Logical Expressions into Sentences

Example
∀x ∀y [(x < 0) ∧ (y < 0) → (xy > 0)],
where x , y are real numbers.
Answer: The product of two negative numbers is positive.

Example
Let L(x , y ) be the statement “x loves y ,” where the domain for both x
and y consists of all people in the world. Use quantifiers to express each of
these statements:
a. There is somebody whom everybody loves.∃x ∀yL(y , x )
b. There are exactly two people whom An loves.

∃x ∃y [x 6= y ∧ L(An, x ) ∧ L(An, y ) ∧ ∀z (x 6= z ∧ y 6= z → ¬L(An, z))]

ThienNV (FPTU) Chapter 1. Logic and Proofs 27 / 1


Example
Let C (x ) be the statement ”x has a car” and R(x , y ) = ”x and y are
room-mates”. Express the sentence ”Each student either has a car or has a
room-mate who has a car” using quantifiers.
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 28 / 1


Example
Let C (x ) be the statement ”x has a car” and R(x , y ) = ”x and y are
room-mates”. Express the sentence ”Each student either has a car or has a
room-mate who has a car” using quantifiers.
Answer: ∀x [C (x ) ∨ ∃y (R(x , y ) ∧ C (y ))].

ThienNV (FPTU) Chapter 1. Logic and Proofs 28 / 1


Example
Let C (x ) be the statement ”x has a car” and R(x , y ) = ”x and y are
room-mates”. Express the sentence ”Each student either has a car or has a
room-mate who has a car” using quantifiers.
Answer: ∀x [C (x ) ∨ ∃y (R(x , y ) ∧ C (y ))].

ThienNV (FPTU) Chapter 1. Logic and Proofs 28 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).
Example
Find the negation of

∀x ∃y (∃zT (x , y , z) ∧ Q(x , y )).

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).
Example
Find the negation of

∀x ∃y (∃zT (x , y , z) ∧ Q(x , y )).

Answer: We have
¬ [∀x ∃y (∃zT (x , y , z) ∧ Q(x , y ))]

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).
Example
Find the negation of

∀x ∃y (∃zT (x , y , z) ∧ Q(x , y )).

Answer: We have
¬ [∀x ∃y (∃zT (x , y , z) ∧ Q(x , y ))]
= ∃x ∀y ¬(∃zT (x , y , z) ∧ Q(x , y ))

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).
Example
Find the negation of

∀x ∃y (∃zT (x , y , z) ∧ Q(x , y )).

Answer: We have
¬ [∀x ∃y (∃zT (x , y , z) ∧ Q(x , y ))]
= ∃x ∀y ¬(∃zT (x , y , z) ∧ Q(x , y ))
= ∃x ∀y [¬(∃zT (x , y , z)) ∨ ¬Q(x , y )]

ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1


Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).
Example
Find the negation of

∀x ∃y (∃zT (x , y , z) ∧ Q(x , y )).

Answer: We have
¬ [∀x ∃y (∃zT (x , y , z) ∧ Q(x , y ))]
= ∃x ∀y ¬(∃zT (x , y , z) ∧ Q(x , y ))
= ∃x ∀y [¬(∃zT (x , y , z)) ∨ ¬Q(x , y )]
= ∃x ∀y [∀z¬T (x , y , z) ∨ ¬Q(x , y )] .
ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1
Negating Nested Quantifiers
¬(∀x ∀yP(x , y )) = ∃x ∃y ¬P(x , y )
¬(∀x ∃yP(x , y )) = ∃x ∀y ¬P(x , y )
¬(∃x ∀yP(x , y )) = ∀x ∃y ¬P(x , y )
¬(∃x ∃yP(x , y )) = ∀x ∀y ¬P(x , y ).
Example
Find the negation of

∀x ∃y (∃zT (x , y , z) ∧ Q(x , y )).

Answer: We have
¬ [∀x ∃y (∃zT (x , y , z) ∧ Q(x , y ))]
= ∃x ∀y ¬(∃zT (x , y , z) ∧ Q(x , y ))
= ∃x ∀y [¬(∃zT (x , y , z)) ∨ ¬Q(x , y )]
= ∃x ∀y [∀z¬T (x , y , z) ∨ ¬Q(x , y )] .
ThienNV (FPTU) Chapter 1. Logic and Proofs 29 / 1
Example
Translate the statement ” For all real numbers x there is a real number y
such that x = y 3 ” into logical expressions, then find the negation
statement.
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 30 / 1


Example
Translate the statement ” For all real numbers x there is a real number y
such that x = y 3 ” into logical expressions, then find the negation
statement.
Answer: ” For all real numbers x there is a real number y such that
x = y 3 ” : ∀x ∃y (x = y 3 ).

ThienNV (FPTU) Chapter 1. Logic and Proofs 30 / 1


Example
Translate the statement ” For all real numbers x there is a real number y
such that x = y 3 ” into logical expressions, then find the negation
statement.
Answer: ” For all real numbers x there is a real number y such that
x = y 3 ” : ∀x ∃y (x = y 3 ). We can see that this is a true statement.
The negation of ”For all real numbers x there is a real number y such that
x = y 3 ” is ”There is a real number x that for any real number y then
x 6= y 3 : ” ∃x ∀y (x 6= y 3 ).

ThienNV (FPTU) Chapter 1. Logic and Proofs 30 / 1


Example
Translate the statement ” For all real numbers x there is a real number y
such that x = y 3 ” into logical expressions, then find the negation
statement.
Answer: ” For all real numbers x there is a real number y such that
x = y 3 ” : ∀x ∃y (x = y 3 ). We can see that this is a true statement.
The negation of ”For all real numbers x there is a real number y such that
x = y 3 ” is ”There is a real number x that for any real number y then
x 6= y 3 : ” ∃x ∀y (x 6= y 3 ). This is a false statement.

ThienNV (FPTU) Chapter 1. Logic and Proofs 30 / 1


Example
Translate the statement ” For all real numbers x there is a real number y
such that x = y 3 ” into logical expressions, then find the negation
statement.
Answer: ” For all real numbers x there is a real number y such that
x = y 3 ” : ∀x ∃y (x = y 3 ). We can see that this is a true statement.
The negation of ”For all real numbers x there is a real number y such that
x = y 3 ” is ”There is a real number x that for any real number y then
x 6= y 3 : ” ∃x ∀y (x 6= y 3 ). This is a false statement.

ThienNV (FPTU) Chapter 1. Logic and Proofs 30 / 1


1.6 Rules of Inference

Definition
An argument is a sequence of statements that end with a conclusion.
An argument is valid if the conclusion follows from the truth of the
preceding statements (premises or hypotheses).
In propositional logic, an argument is valid if it is based on a
tautology.
Arguments that are not based on tautology are called fallacies.

Example
”If 1+1=3 then pig can fly” is valid since 0 → 0 = 1.
”If it is rainy, I will be at home. Today, I am not at home. Hence, it is not
rainy” is valid.

ThienNV (FPTU) Chapter 1. Logic and Proofs 31 / 1


1.6 Rules of Inference

Definition
An argument is a sequence of statements that end with a conclusion.
An argument is valid if the conclusion follows from the truth of the
preceding statements (premises or hypotheses).
In propositional logic, an argument is valid if it is based on a
tautology.
Arguments that are not based on tautology are called fallacies.

Example
”If 1+1=3 then pig can fly” is valid since 0 → 0 = 1.
”If it is rainy, I will be at home. Today, I am not at home. Hence, it is not
rainy” is valid.

ThienNV (FPTU) Chapter 1. Logic and Proofs 31 / 1


Name Rule of Inference Tautology
p
Addition p → (p ∨ q)
∴p∨q
p∧q
Simplification p∧q →p
∴p
p→q
p
Modus ponens p ∧ (p → q) → q
∴q
p→q
¬q
Modus tollens ¬q ∧ (p → q) → ¬p
∴ ¬p
p→q
q→r
Hypothetical syllogism (p → q) ∧ (q → r ) → (p → r )
∴p→r
p∨q
¬p
Disjunctive syllogism (p ∨ q) ∧ (¬p) → q
ThienNV (FPTU)
∴q
Chapter 1. Logic and Proofs 32 / 1
Example

ThienNV (FPTU) Chapter 1. Logic and Proofs 33 / 1


Example
Given the hypotheses:
I work hard or I am smart.
I am not smart.
If I work hard I will pass the exam.
If I am not lucky then I will not pass the exam.
Which conclusion can be drawn?
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 34 / 1


Example
Given the hypotheses:
I work hard or I am smart.
I am not smart.
If I work hard I will pass the exam.
If I am not lucky then I will not pass the exam.
Which conclusion can be drawn?
Answer: Set p=”I work hard”, q=”I am smart”, r =”I will pass the
exam”, s=”I am not lucky”. Rewrite the hypotheses:

ThienNV (FPTU) Chapter 1. Logic and Proofs 34 / 1


Example
Given the hypotheses:
I work hard or I am smart.
I am not smart.
If I work hard I will pass the exam.
If I am not lucky then I will not pass the exam.
Which conclusion can be drawn?
Answer: Set p=”I work hard”, q=”I am smart”, r =”I will pass the
exam”, s=”I am not lucky”. Rewrite the hypotheses:

1. p ∨ q 2. ¬q 3. p → r 4. s → ¬r

We have 1. ∧ 2. → 5. p (by disjunctive syllogism), 5. ∧ 3. → 6. r (by modus


ponens), 4. ∧ 6. → ¬s (by mudus tollens). Hence we can draw conclusion

”I work hard and I will pass the example and I am lucky”.

ThienNV (FPTU) Chapter 1. Logic and Proofs 34 / 1


Example
Given the hypotheses:
I work hard or I am smart.
I am not smart.
If I work hard I will pass the exam.
If I am not lucky then I will not pass the exam.
Which conclusion can be drawn?
Answer: Set p=”I work hard”, q=”I am smart”, r =”I will pass the
exam”, s=”I am not lucky”. Rewrite the hypotheses:

1. p ∨ q 2. ¬q 3. p → r 4. s → ¬r

We have 1. ∧ 2. → 5. p (by disjunctive syllogism), 5. ∧ 3. → 6. r (by modus


ponens), 4. ∧ 6. → ¬s (by mudus tollens). Hence we can draw conclusion

”I work hard and I will pass the example and I am lucky”.

ThienNV (FPTU) Chapter 1. Logic and Proofs 34 / 1


Example
Given the hypotheses:
”It is not sunny and is cold”
”We go swimming only if it is sunny”
”If we do not go swimming then we will play soccer”
”If we play soccer then we will go home by sunset”
Which conclusion can be drawn?
Answer:

ThienNV (FPTU) Chapter 1. Logic and Proofs 35 / 1


Example
Given the hypotheses:
”It is not sunny and is cold”
”We go swimming only if it is sunny”
”If we do not go swimming then we will play soccer”
”If we play soccer then we will go home by sunset”
Which conclusion can be drawn?
Answer: Set p=”It is sunny”, q=”It is cold”, r =”We go swimming”,
s=”We will play soccer”, t= ”We will go home by sunset”. Rewrite the
hypotheses:

ThienNV (FPTU) Chapter 1. Logic and Proofs 35 / 1


Example
Given the hypotheses:
”It is not sunny and is cold”
”We go swimming only if it is sunny”
”If we do not go swimming then we will play soccer”
”If we play soccer then we will go home by sunset”
Which conclusion can be drawn?
Answer: Set p=”It is sunny”, q=”It is cold”, r =”We go swimming”,
s=”We will play soccer”, t= ”We will go home by sunset”. Rewrite the
hypotheses:

1. ¬p ∧ q 2. r → p 3. ¬r → s 4. s → t

We have 1. → 5.¬p by simplification, 2. ∧ 5. → 6. ¬r by modus tollens,


3. ∧ 4. → 7. ¬r → t by hypothetical syllogism, 6. ∧ 7. → t by modus
ponens, 3. ∧ 6. → 8.s. Hence we can draw conclusion

”We do not go swimming, we will go home by sunset and we play soccer”.


ThienNV (FPTU) Chapter 1. Logic and Proofs 35 / 1
Example
Given the hypotheses:
”It is not sunny and is cold”
”We go swimming only if it is sunny”
”If we do not go swimming then we will play soccer”
”If we play soccer then we will go home by sunset”
Which conclusion can be drawn?
Answer: Set p=”It is sunny”, q=”It is cold”, r =”We go swimming”,
s=”We will play soccer”, t= ”We will go home by sunset”. Rewrite the
hypotheses:

1. ¬p ∧ q 2. r → p 3. ¬r → s 4. s → t

We have 1. → 5.¬p by simplification, 2. ∧ 5. → 6. ¬r by modus tollens,


3. ∧ 4. → 7. ¬r → t by hypothetical syllogism, 6. ∧ 7. → t by modus
ponens, 3. ∧ 6. → 8.s. Hence we can draw conclusion

”We do not go swimming, we will go home by sunset and we play soccer”.


ThienNV (FPTU) Chapter 1. Logic and Proofs 35 / 1
Fallacies

Fallacy of affirming the conclusion: [(p → q) ∧ q] → p


Fallacy of denying the hypothesis: [(p → q) ∧ ¬p] → ¬q

ThienNV (FPTU) Chapter 1. Logic and Proofs 36 / 1


Fallacies

Fallacy of affirming the conclusion: [(p → q) ∧ q] → p


Fallacy of denying the hypothesis: [(p → q) ∧ ¬p] → ¬q

Example
”If John is a soccer player then John is rich. John only plays volleyball.
Therefore John is not rich.” is a fallacy of denying the hypothesis.

ThienNV (FPTU) Chapter 1. Logic and Proofs 36 / 1


Fallacies

Fallacy of affirming the conclusion: [(p → q) ∧ q] → p


Fallacy of denying the hypothesis: [(p → q) ∧ ¬p] → ¬q

Example
”If John is a soccer player then John is rich. John only plays volleyball.
Therefore John is not rich.” is a fallacy of denying the hypothesis.
”If John is a soccer player then John is rich. John is rich. Therefore John
is a soccer player.” is a fallacy of affirming the conclusion.

ThienNV (FPTU) Chapter 1. Logic and Proofs 36 / 1


Fallacies

Fallacy of affirming the conclusion: [(p → q) ∧ q] → p


Fallacy of denying the hypothesis: [(p → q) ∧ ¬p] → ¬q

Example
”If John is a soccer player then John is rich. John only plays volleyball.
Therefore John is not rich.” is a fallacy of denying the hypothesis.
”If John is a soccer player then John is rich. John is rich. Therefore John
is a soccer player.” is a fallacy of affirming the conclusion.

ThienNV (FPTU) Chapter 1. Logic and Proofs 36 / 1


Exercises

Section 1.1: 2, 6, 10, 16, 18, 20, 24, 32, 46, 48 (page 13-17)

Section 1.3: 11, 21, 22, 26, 34, 36 (page 38)

Section 1.4: 2, 6, 12, 14, 20, 45, 46 (page 57-59)

Section 1.5: 2, 4, 9, 27, 28, 31, 40 (page 68-72)

Section 1.6: 3, 4, 10 (page 82)

ThienNV (FPTU) Chapter 1. Logic and Proofs 37 / 1

You might also like