94
Discrete Mathematics and Its Applications Lecture 1: The Foundations: Logic and Proofs (1.3-1.5) MING GAO DASE @ ECNU (for course related communications) [email protected] Mar. 10, 2020

Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Discrete Mathematics and Its ApplicationsLecture 1: The Foundations: Logic and Proofs (1.3-1.5)

MING GAO

DASE @ ECNU(for course related communications)

[email protected]

Mar. 10, 2020

Page 2: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Outline

1 Logical Equivalences

2 Propositional Satisfiability

3 Predicates

4 Quantifiers

5 Applications of Quantifiers

6 Nested Quantifiers

7 Take-aways

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 2 / 28

Page 3: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Motivation

Example

There are two kinds of inhabitants in an island, knights, who alwaystell the truth, knaves, who always lie. You encounter two people Aand B. What are A and B if A says “B is a knight” and B says “Thetwo of us are opposite types”?

Solution:

p : “A is a knight;”

q : “B is a knight;”

If A is a knight, we have p ∧ q ∧ ((¬p ∧ q) ∨ (p ∧ ¬q)).

If A is a knave, we have ¬p ∧ ¬q ∧ ((p ∧ q) ∨ (¬p ∧ ¬q)).

The problem is how to determine the truth value of the propositions.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 3 / 28

Page 4: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Motivation

Example

There are two kinds of inhabitants in an island, knights, who alwaystell the truth, knaves, who always lie. You encounter two people Aand B. What are A and B if A says “B is a knight” and B says “Thetwo of us are opposite types”?Solution:

p : “A is a knight;”

q : “B is a knight;”

If A is a knight, we have p ∧ q ∧ ((¬p ∧ q) ∨ (p ∧ ¬q)).

If A is a knave, we have ¬p ∧ ¬q ∧ ((p ∧ q) ∨ (¬p ∧ ¬q)).

The problem is how to determine the truth value of the propositions.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 3 / 28

Page 5: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Motivation

Example

There are two kinds of inhabitants in an island, knights, who alwaystell the truth, knaves, who always lie. You encounter two people Aand B. What are A and B if A says “B is a knight” and B says “Thetwo of us are opposite types”?Solution:

p : “A is a knight;”

q : “B is a knight;”

If A is a knight, we have p ∧ q ∧ ((¬p ∧ q) ∨ (p ∧ ¬q)).

If A is a knave, we have ¬p ∧ ¬q ∧ ((p ∧ q) ∨ (¬p ∧ ¬q)).

The problem is how to determine the truth value of the propositions.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 3 / 28

Page 6: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Motivation

Example

There are two kinds of inhabitants in an island, knights, who alwaystell the truth, knaves, who always lie. You encounter two people Aand B. What are A and B if A says “B is a knight” and B says “Thetwo of us are opposite types”?Solution:

p : “A is a knight;”

q : “B is a knight;”

If A is a knight, we have p ∧ q ∧ ((¬p ∧ q) ∨ (p ∧ ¬q)).

If A is a knave, we have ¬p ∧ ¬q ∧ ((p ∧ q) ∨ (¬p ∧ ¬q)).

The problem is how to determine the truth value of the propositions.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 3 / 28

Page 7: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Motivation

Example

There are two kinds of inhabitants in an island, knights, who alwaystell the truth, knaves, who always lie. You encounter two people Aand B. What are A and B if A says “B is a knight” and B says “Thetwo of us are opposite types”?Solution:

p : “A is a knight;”

q : “B is a knight;”

If A is a knight, we have p ∧ q ∧ ((¬p ∧ q) ∨ (p ∧ ¬q)).

If A is a knave, we have ¬p ∧ ¬q ∧ ((p ∧ q) ∨ (¬p ∧ ¬q)).

The problem is how to determine the truth value of the propositions.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 3 / 28

Page 8: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences

Definition

Compound propositions that have the same truth values in all possiblecases are called logically equivalent.

Compound propositions p and q are called logically equivalent ifp ↔ q is a tautology, denoted as p ≡ q or p ⇔ q.

Remark: Symbol ≡ is not a logical connectives, and p ≡ q is not aproposition.

One way to determine whether two compound propositions areequivalent is to use a truth table.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 4 / 28

Page 9: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences

Definition

Compound propositions that have the same truth values in all possiblecases are called logically equivalent.

Compound propositions p and q are called logically equivalent ifp ↔ q is a tautology, denoted as p ≡ q or p ⇔ q.

Remark: Symbol ≡ is not a logical connectives, and p ≡ q is not aproposition.

One way to determine whether two compound propositions areequivalent is to use a truth table.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 4 / 28

Page 10: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences

Definition

Compound propositions that have the same truth values in all possiblecases are called logically equivalent.

Compound propositions p and q are called logically equivalent ifp ↔ q is a tautology, denoted as p ≡ q or p ⇔ q.

Remark: Symbol ≡ is not a logical connectives, and p ≡ q is not aproposition.

One way to determine whether two compound propositions areequivalent is to use a truth table.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 4 / 28

Page 11: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences

Definition

Compound propositions that have the same truth values in all possiblecases are called logically equivalent.

Compound propositions p and q are called logically equivalent ifp ↔ q is a tautology, denoted as p ≡ q or p ⇔ q.

Remark: Symbol ≡ is not a logical connectives, and p ≡ q is not aproposition.

One way to determine whether two compound propositions areequivalent is to use a truth table.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 4 / 28

Page 12: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

De Morgan’s laws

Laws

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

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

¬(p1 ∧ p2 ∧ · · · ∧ pn) ≡ ¬p1 ∨ ¬p2 ∨ ¬ · · · ∨ ¬pn, i.e.,¬∧n

i=1 pi ≡∨n

i=1 ¬pi .

¬(p1 ∨ p2 ∨ · · · ∨ pn) ≡ ¬p1 ∧ ¬p2 ∧ ¬ · · · ∧ ¬pn, i.e.,¬∨n

i=1 pi ≡∧n

i=1 ¬pi .

The truth table can be used to determine whether two compoundpropositions are equivalent.

p q p ∧ q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q

T T T F F F FT F F T F T TF T F T T F TF F F T T T T

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 5 / 28

Page 13: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

De Morgan’s laws

Laws

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

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

¬(p1 ∧ p2 ∧ · · · ∧ pn) ≡ ¬p1 ∨ ¬p2 ∨ ¬ · · · ∨ ¬pn, i.e.,¬∧n

i=1 pi ≡∨n

i=1 ¬pi .

¬(p1 ∨ p2 ∨ · · · ∨ pn) ≡ ¬p1 ∧ ¬p2 ∧ ¬ · · · ∧ ¬pn, i.e.,¬∨n

i=1 pi ≡∧n

i=1 ¬pi .

The truth table can be used to determine whether two compoundpropositions are equivalent.

p q p ∧ q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q

T T T F F F FT F F T F T TF T F T T F TF F F T T T T

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 5 / 28

Page 14: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

De Morgan’s laws

Laws

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

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

¬(p1 ∧ p2 ∧ · · · ∧ pn) ≡ ¬p1 ∨ ¬p2 ∨ ¬ · · · ∨ ¬pn, i.e.,¬∧n

i=1 pi ≡∨n

i=1 ¬pi .

¬(p1 ∨ p2 ∨ · · · ∨ pn) ≡ ¬p1 ∧ ¬p2 ∧ ¬ · · · ∧ ¬pn, i.e.,¬∨n

i=1 pi ≡∧n

i=1 ¬pi .

The truth table can be used to determine whether two compoundpropositions are equivalent.

p q p ∧ q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q

T T T F F F FT F F T F T TF T F T T F TF F F T T T T

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 5 / 28

Page 15: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalence

Table of logical equivalence

equivalence name

p ∧ T ≡ p Identity lawsp ∨ F ≡ p

p ∧ p ≡ p Idempotent lawsp ∨ p ≡ p

(p ∧ q) ∧ r ≡ p ∧ (q ∧ r) Associative laws(p ∨ q) ∨ r ≡ p ∨ (q ∨ r)

p ∨ (p ∧ q) ≡ p Absorption lawsp ∧ (p ∨ q) ≡ p

p ∧ ¬p ≡ F Negation lawsp ∨ ¬p ≡ T

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 6 / 28

Page 16: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalence Cont’d

Table of logical equivalence

equivalence name

p ∨ T ≡ T Domination lawsp ∧ F ≡ F

p ∧ q ≡ q ∧ p Commutative lawsp ∨ q ≡ q ∨ p

(p ∧ q) ∨ r ≡ (p ∨ r) ∧ (q ∨ r) Distributive laws(p ∨ q) ∧ r ≡ (p ∧ r) ∨ (q ∧ r)

¬(p ∧ q) ≡ ¬p ∨ ¬q De Morgan’s laws¬(p ∨ q) ≡ ¬p ∧ ¬q

¬(¬p) ≡ p Double negation law

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 7 / 28

Page 17: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Equivalence of implication

Equivalence law

p → q ≡ ¬p ∨ q

The truth table can be used to determine whether two compoundpropositions are equivalent.

p q p → q ¬p ¬p ∨ q

T T T F TT F F F FF T T T TF F T T T

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 8 / 28

Page 18: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Equivalence of implication

Equivalence law

p → q ≡ ¬p ∨ qThe truth table can be used to determine whether two compoundpropositions are equivalent.

p q p → q ¬p ¬p ∨ q

T T T F TT F F F FF T T T TF F T T T

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 8 / 28

Page 19: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 20: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 21: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 22: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 23: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 24: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 25: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 26: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 27: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving conditional statements

Table of logical equivalences involving conditional statements

p → q ≡ ¬p ∨ q

p → q ≡ ¬q → ¬p

p ∨ q ≡ ¬p → q

p ∧ q ≡ ¬(p → ¬q)

¬(p → q) ≡ p ∧ ¬q

(p → q) ∧ (p → r) ≡ p → (q ∧ r)

(p → q) ∨ (p → r) ≡ p → (q ∨ r)

(p → r) ∧ (q → r) ≡ (p ∨ q)→ r

(p → r) ∨ (q → r) ≡ (p ∧ q)→ r

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 9 / 28

Page 28: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving biconditional statements

Table of logical equivalences involving biconditional statements

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

p ↔ q ≡ ¬p ↔ ¬q

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

¬(p ↔ q) ≡ p ↔ ¬q

Show that ¬(p ↔ q) and p ↔ ¬q are logically equivalent.

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

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

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

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

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

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

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 10 / 28

Page 29: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving biconditional statements

Table of logical equivalences involving biconditional statements

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

p ↔ q ≡ ¬p ↔ ¬q

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

¬(p ↔ q) ≡ p ↔ ¬q

Show that ¬(p ↔ q) and p ↔ ¬q are logically equivalent.

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

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

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

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

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

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

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 10 / 28

Page 30: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving biconditional statements

Table of logical equivalences involving biconditional statements

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

p ↔ q ≡ ¬p ↔ ¬q

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

¬(p ↔ q) ≡ p ↔ ¬q

Show that ¬(p ↔ q) and p ↔ ¬q are logically equivalent.

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

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

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

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

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

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

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 10 / 28

Page 31: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving biconditional statements

Table of logical equivalences involving biconditional statements

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

p ↔ q ≡ ¬p ↔ ¬q

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

¬(p ↔ q) ≡ p ↔ ¬q

Show that ¬(p ↔ q) and p ↔ ¬q are logically equivalent.

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

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

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

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

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

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

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 10 / 28

Page 32: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Logical Equivalences

Logical equivalences involving biconditional statements

Table of logical equivalences involving biconditional statements

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

p ↔ q ≡ ¬p ↔ ¬q

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

¬(p ↔ q) ≡ p ↔ ¬q

Show that ¬(p ↔ q) and p ↔ ¬q are logically equivalent.

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

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

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

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

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

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

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 10 / 28

Page 33: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Propositional satisfiability

Definition

A compound proposition is satisfiable if there is an assignment oftruth values to its variables that makes it true.

Determine whether each of the compound propositions(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p).

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

Note that (p ∨¬q)∧ (q ∨¬r)∧ (r ∨¬p) is true when the three variable p,q, and r have the same truth value.Hence, it is satisfiable as there is at least one assignment of truth valuesfor p, q, and r that makes it true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 11 / 28

Page 34: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Propositional satisfiability

Definition

A compound proposition is satisfiable if there is an assignment oftruth values to its variables that makes it true.

Determine whether each of the compound propositions(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p).

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

Note that (p ∨¬q)∧ (q ∨¬r)∧ (r ∨¬p) is true when the three variable p,q, and r have the same truth value.Hence, it is satisfiable as there is at least one assignment of truth valuesfor p, q, and r that makes it true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 11 / 28

Page 35: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Propositional satisfiability

Definition

A compound proposition is satisfiable if there is an assignment oftruth values to its variables that makes it true.

Determine whether each of the compound propositions(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p).

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

Note that (p ∨¬q)∧ (q ∨¬r)∧ (r ∨¬p) is true when the three variable p,q, and r have the same truth value.Hence, it is satisfiable as there is at least one assignment of truth valuesfor p, q, and r that makes it true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 11 / 28

Page 36: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Propositional satisfiability

Definition

A compound proposition is satisfiable if there is an assignment oftruth values to its variables that makes it true.

Determine whether each of the compound propositions(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p).

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

Note that (p ∨¬q)∧ (q ∨¬r)∧ (r ∨¬p) is true when the three variable p,q, and r have the same truth value.

Hence, it is satisfiable as there is at least one assignment of truth valuesfor p, q, and r that makes it true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 11 / 28

Page 37: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Propositional satisfiability

Definition

A compound proposition is satisfiable if there is an assignment oftruth values to its variables that makes it true.

Determine whether each of the compound propositions(p ∨ ¬q) ∧ (q ∨ ¬r) ∧ (r ∨ ¬p).

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

Note that (p ∨¬q)∧ (q ∨¬r)∧ (r ∨¬p) is true when the three variable p,q, and r have the same truth value.Hence, it is satisfiable as there is at least one assignment of truth valuesfor p, q, and r that makes it true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 11 / 28

Page 38: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Applications of satisfiability

Sudoku puzzle

For each cell with a given value, we as-sert p(i , j , n) when the cell in row i andcolumn j has the given value n.

For every row, we assert:∧9

i=1

∧9n=1

∨9j=1 p(i , j , n);

For every column, we assert:∧9

j=1

∧9n=1

∨9i=1 p(i , j , n);

For every block, we assert it contains every number:∧2r=0

∧2s=0

∧9n=1

∨3i=1

∨3j=1 p(3r + i , cs + j , n);

To assert that no cell contains more than one number, we takethe conjunction over all values of n, n

′, i , and j where each

variable ranges from 1 to 9 and n 6= n′

ofp(i , j , n)→ ¬p(i , j , n

′).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 12 / 28

Page 39: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Applications of satisfiability

Sudoku puzzle

For each cell with a given value, we as-sert p(i , j , n) when the cell in row i andcolumn j has the given value n.

For every row, we assert:∧9

i=1

∧9n=1

∨9j=1 p(i , j , n);

For every column, we assert:∧9

j=1

∧9n=1

∨9i=1 p(i , j , n);

For every block, we assert it contains every number:∧2r=0

∧2s=0

∧9n=1

∨3i=1

∨3j=1 p(3r + i , cs + j , n);

To assert that no cell contains more than one number, we takethe conjunction over all values of n, n

′, i , and j where each

variable ranges from 1 to 9 and n 6= n′

ofp(i , j , n)→ ¬p(i , j , n

′).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 12 / 28

Page 40: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Applications of satisfiability

Sudoku puzzle

For each cell with a given value, we as-sert p(i , j , n) when the cell in row i andcolumn j has the given value n.

For every row, we assert:∧9

i=1

∧9n=1

∨9j=1 p(i , j , n);

For every column, we assert:∧9

j=1

∧9n=1

∨9i=1 p(i , j , n);

For every block, we assert it contains every number:∧2r=0

∧2s=0

∧9n=1

∨3i=1

∨3j=1 p(3r + i , cs + j , n);

To assert that no cell contains more than one number, we takethe conjunction over all values of n, n

′, i , and j where each

variable ranges from 1 to 9 and n 6= n′

ofp(i , j , n)→ ¬p(i , j , n

′).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 12 / 28

Page 41: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Applications of satisfiability

Sudoku puzzle

For each cell with a given value, we as-sert p(i , j , n) when the cell in row i andcolumn j has the given value n.

For every row, we assert:∧9

i=1

∧9n=1

∨9j=1 p(i , j , n);

For every column, we assert:∧9

j=1

∧9n=1

∨9i=1 p(i , j , n);

For every block, we assert it contains every number:∧2r=0

∧2s=0

∧9n=1

∨3i=1

∨3j=1 p(3r + i , cs + j , n);

To assert that no cell contains more than one number, we takethe conjunction over all values of n, n

′, i , and j where each

variable ranges from 1 to 9 and n 6= n′

ofp(i , j , n)→ ¬p(i , j , n

′).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 12 / 28

Page 42: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Propositional Satisfiability

Applications of satisfiability

Sudoku puzzle

For each cell with a given value, we as-sert p(i , j , n) when the cell in row i andcolumn j has the given value n.

For every row, we assert:∧9

i=1

∧9n=1

∨9j=1 p(i , j , n);

For every column, we assert:∧9

j=1

∧9n=1

∨9i=1 p(i , j , n);

For every block, we assert it contains every number:∧2r=0

∧2s=0

∧9n=1

∨3i=1

∨3j=1 p(3r + i , cs + j , n);

To assert that no cell contains more than one number, we takethe conjunction over all values of n, n

′, i , and j where each

variable ranges from 1 to 9 and n 6= n′

ofp(i , j , n)→ ¬p(i , j , n

′).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 12 / 28

Page 43: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation I

In many cases, the statement we are interested in contains variables.

Example

“e is even”, “p is prime”, or “s is a student”.

As we previously did with propositions, we can use variables to rep-resent these statements.

E (x) : “x is even”;

P(y) : “y is prime”;

S(w) : “w is a student”.

You can think of E (x), P(y) and S(w) as statements that may betrue of false depending on the values of its variables.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 13 / 28

Page 44: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation I

In many cases, the statement we are interested in contains variables.

Example

“e is even”, “p is prime”, or “s is a student”.As we previously did with propositions, we can use variables to rep-resent these statements.

E (x) : “x is even”;

P(y) : “y is prime”;

S(w) : “w is a student”.

You can think of E (x), P(y) and S(w) as statements that may betrue of false depending on the values of its variables.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 13 / 28

Page 45: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation I

In many cases, the statement we are interested in contains variables.

Example

“e is even”, “p is prime”, or “s is a student”.As we previously did with propositions, we can use variables to rep-resent these statements.

E (x) : “x is even”;

P(y) : “y is prime”;

S(w) : “w is a student”.

You can think of E (x), P(y) and S(w) as statements that may betrue of false depending on the values of its variables.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 13 / 28

Page 46: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation I

In many cases, the statement we are interested in contains variables.

Example

“e is even”, “p is prime”, or “s is a student”.As we previously did with propositions, we can use variables to rep-resent these statements.

E (x) : “x is even”;

P(y) : “y is prime”;

S(w) : “w is a student”.

You can think of E (x), P(y) and S(w) as statements that may betrue of false depending on the values of its variables.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 13 / 28

Page 47: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation I

In many cases, the statement we are interested in contains variables.

Example

“e is even”, “p is prime”, or “s is a student”.As we previously did with propositions, we can use variables to rep-resent these statements.

E (x) : “x is even”;

P(y) : “y is prime”;

S(w) : “w is a student”.

You can think of E (x), P(y) and S(w) as statements that may betrue of false depending on the values of its variables.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 13 / 28

Page 48: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation II

Example

“Every computer connected to the university network isfunctioning properly.”No rules of propositional logic allow us to conclude the truth ofthe statement“MATH3 is functioning properly, if MATH3 is one of thecomputers connected to the university network.”

Likewise, we cannot use the rules of propositional logic toconclude from the statement“CS2 is under attack by an intruder, and CS2 is a computer onthe university network.”We can conclude the truth of “There is a computer on theuniversity network that is under attack by an intruder.”

Predicate logic is a more powerful type of logic theory.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 14 / 28

Page 49: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation II

Example

“Every computer connected to the university network isfunctioning properly.”No rules of propositional logic allow us to conclude the truth ofthe statement“MATH3 is functioning properly, if MATH3 is one of thecomputers connected to the university network.”

Likewise, we cannot use the rules of propositional logic toconclude from the statement“CS2 is under attack by an intruder, and CS2 is a computer onthe university network.”We can conclude the truth of “There is a computer on theuniversity network that is under attack by an intruder.”

Predicate logic is a more powerful type of logic theory.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 14 / 28

Page 50: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Motivation II

Example

“Every computer connected to the university network isfunctioning properly.”No rules of propositional logic allow us to conclude the truth ofthe statement“MATH3 is functioning properly, if MATH3 is one of thecomputers connected to the university network.”

Likewise, we cannot use the rules of propositional logic toconclude from the statement“CS2 is under attack by an intruder, and CS2 is a computer onthe university network.”We can conclude the truth of “There is a computer on theuniversity network that is under attack by an intruder.”

Predicate logic is a more powerful type of logic theory.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 14 / 28

Page 51: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Predicates

Definition

“x is greater than 3” has two parts: variable x (the subject of the state-ment), and predicate P “is greater than 3”, denoted as P(x) : x > 3.

Statement P(x) is the value of the propositional function P at x ;

Once variable x is fixed, statement P(x) becomes a proposition andhas a truth value. e.g., P(4) (true) and P(2) (false)

Let A(x) denote “Computer x is under attack by an intruder”.Assume that CS2 in the campus is currently under attack byintruders. What are truth values of A(CS1), and A(CS2)?

Let Q(x , y) denote the statement “x = y + 3”. What are the truthvalues of the propositions Q(1, 2) and Q(3, 0)?

In general, a statement involving n variables x1, x2, · · · , xn can be denotedby P(x1, x2, · · · , xn), where P is also called an n-place predicate or a n-arypredicate, and x1, x2, · · · , xn is a n-tuple.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 15 / 28

Page 52: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Predicates

Definition

“x is greater than 3” has two parts: variable x (the subject of the state-ment), and predicate P “is greater than 3”, denoted as P(x) : x > 3.

Statement P(x) is the value of the propositional function P at x ;

Once variable x is fixed, statement P(x) becomes a proposition andhas a truth value. e.g., P(4) (true) and P(2) (false)

Let A(x) denote “Computer x is under attack by an intruder”.Assume that CS2 in the campus is currently under attack byintruders. What are truth values of A(CS1), and A(CS2)?

Let Q(x , y) denote the statement “x = y + 3”. What are the truthvalues of the propositions Q(1, 2) and Q(3, 0)?

In general, a statement involving n variables x1, x2, · · · , xn can be denotedby P(x1, x2, · · · , xn), where P is also called an n-place predicate or a n-arypredicate, and x1, x2, · · · , xn is a n-tuple.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 15 / 28

Page 53: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Predicates

Definition

“x is greater than 3” has two parts: variable x (the subject of the state-ment), and predicate P “is greater than 3”, denoted as P(x) : x > 3.

Statement P(x) is the value of the propositional function P at x ;

Once variable x is fixed, statement P(x) becomes a proposition andhas a truth value. e.g., P(4) (true) and P(2) (false)

Let A(x) denote “Computer x is under attack by an intruder”.Assume that CS2 in the campus is currently under attack byintruders. What are truth values of A(CS1), and A(CS2)?

Let Q(x , y) denote the statement “x = y + 3”. What are the truthvalues of the propositions Q(1, 2) and Q(3, 0)?

In general, a statement involving n variables x1, x2, · · · , xn can be denotedby P(x1, x2, · · · , xn), where P is also called an n-place predicate or a n-arypredicate, and x1, x2, · · · , xn is a n-tuple.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 15 / 28

Page 54: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Predicates

Definition

“x is greater than 3” has two parts: variable x (the subject of the state-ment), and predicate P “is greater than 3”, denoted as P(x) : x > 3.

Statement P(x) is the value of the propositional function P at x ;

Once variable x is fixed, statement P(x) becomes a proposition andhas a truth value. e.g., P(4) (true) and P(2) (false)

Let A(x) denote “Computer x is under attack by an intruder”.Assume that CS2 in the campus is currently under attack byintruders. What are truth values of A(CS1), and A(CS2)?

Let Q(x , y) denote the statement “x = y + 3”. What are the truthvalues of the propositions Q(1, 2) and Q(3, 0)?

In general, a statement involving n variables x1, x2, · · · , xn can be denotedby P(x1, x2, · · · , xn), where P is also called an n-place predicate or a n-arypredicate, and x1, x2, · · · , xn is a n-tuple.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 15 / 28

Page 55: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Predicates

Definition

“x is greater than 3” has two parts: variable x (the subject of the state-ment), and predicate P “is greater than 3”, denoted as P(x) : x > 3.

Statement P(x) is the value of the propositional function P at x ;

Once variable x is fixed, statement P(x) becomes a proposition andhas a truth value. e.g., P(4) (true) and P(2) (false)

Let A(x) denote “Computer x is under attack by an intruder”.Assume that CS2 in the campus is currently under attack byintruders. What are truth values of A(CS1), and A(CS2)?

Let Q(x , y) denote the statement “x = y + 3”. What are the truthvalues of the propositions Q(1, 2) and Q(3, 0)?

In general, a statement involving n variables x1, x2, · · · , xn can be denotedby P(x1, x2, · · · , xn), where P is also called an n-place predicate or a n-arypredicate, and x1, x2, · · · , xn is a n-tuple.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 15 / 28

Page 56: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Predicates

Predicates

Definition

“x is greater than 3” has two parts: variable x (the subject of the state-ment), and predicate P “is greater than 3”, denoted as P(x) : x > 3.

Statement P(x) is the value of the propositional function P at x ;

Once variable x is fixed, statement P(x) becomes a proposition andhas a truth value. e.g., P(4) (true) and P(2) (false)

Let A(x) denote “Computer x is under attack by an intruder”.Assume that CS2 in the campus is currently under attack byintruders. What are truth values of A(CS1), and A(CS2)?

Let Q(x , y) denote the statement “x = y + 3”. What are the truthvalues of the propositions Q(1, 2) and Q(3, 0)?

In general, a statement involving n variables x1, x2, · · · , xn can be denotedby P(x1, x2, · · · , xn), where P is also called an n-place predicate or a n-arypredicate, and x1, x2, · · · , xn is a n-tuple.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 15 / 28

Page 57: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers

Quantification

Quantification expresses the extent to which a predicate is true over arange of elements. In general, all values of a variable is called the domainof discourse (or universe of discourse), just referred to as domain.

1 The universal quantification of P(x) is the statement “P(x) for allvalues of x in the domain”. Notation ∀xP(x) denotes the universalquantification of P(x), where ∀ is called the universal quantifier. Anelement for which P(x) is false is called a counterexample of ∀xP(x).

2 The existential quantification of P(x) is the proposition “Thereexists an element x in the domain such that P(x)”. Notation∃xP(x) denotes the existential quantification of P(x), where ∃ iscalled the existential quantifier.

Statement When True? When False?∀xP(x) P(x) is true for every x ∃x for which P(x) is false∃xP(x) ∃x for which P(x) is true P(x) is false for every x

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 16 / 28

Page 58: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers

Quantification

Quantification expresses the extent to which a predicate is true over arange of elements. In general, all values of a variable is called the domainof discourse (or universe of discourse), just referred to as domain.

1 The universal quantification of P(x) is the statement “P(x) for allvalues of x in the domain”. Notation ∀xP(x) denotes the universalquantification of P(x), where ∀ is called the universal quantifier. Anelement for which P(x) is false is called a counterexample of ∀xP(x).

2 The existential quantification of P(x) is the proposition “Thereexists an element x in the domain such that P(x)”. Notation∃xP(x) denotes the existential quantification of P(x), where ∃ iscalled the existential quantifier.

Statement When True? When False?∀xP(x) P(x) is true for every x ∃x for which P(x) is false∃xP(x) ∃x for which P(x) is true P(x) is false for every x

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 16 / 28

Page 59: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers

Quantification

Quantification expresses the extent to which a predicate is true over arange of elements. In general, all values of a variable is called the domainof discourse (or universe of discourse), just referred to as domain.

1 The universal quantification of P(x) is the statement “P(x) for allvalues of x in the domain”. Notation ∀xP(x) denotes the universalquantification of P(x), where ∀ is called the universal quantifier. Anelement for which P(x) is false is called a counterexample of ∀xP(x).

2 The existential quantification of P(x) is the proposition “Thereexists an element x in the domain such that P(x)”. Notation∃xP(x) denotes the existential quantification of P(x), where ∃ iscalled the existential quantifier.

Statement When True? When False?∀xP(x) P(x) is true for every x ∃x for which P(x) is false∃xP(x) ∃x for which P(x) is true P(x) is false for every x

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 16 / 28

Page 60: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers

Quantification

Quantification expresses the extent to which a predicate is true over arange of elements. In general, all values of a variable is called the domainof discourse (or universe of discourse), just referred to as domain.

1 The universal quantification of P(x) is the statement “P(x) for allvalues of x in the domain”. Notation ∀xP(x) denotes the universalquantification of P(x), where ∀ is called the universal quantifier. Anelement for which P(x) is false is called a counterexample of ∀xP(x).

2 The existential quantification of P(x) is the proposition “Thereexists an element x in the domain such that P(x)”. Notation∃xP(x) denotes the existential quantification of P(x), where ∃ iscalled the existential quantifier.

Statement When True? When False?∀xP(x) P(x) is true for every x ∃x for which P(x) is false∃xP(x) ∃x for which P(x) is true P(x) is false for every x

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 16 / 28

Page 61: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Examples

Universal quantification

1 Let P(x) be “x + 1 > x”. What is the truth value of ∀xP(x) for∀x ∈ R?

Note that if the domain is empty, then ∀xP(x) is true for anypropositional function P(x) because there are no elements x in thedomain for which P(x) is false.

2 Let P(x) be “x2 > 0”. What is the truth value of ∀xP(x) for∀x ∈ Z ? (Note that x = 0 is a counterexample because x2 = 0.)

Existential quantification

1 Let P(x) denote “x > 3”. What is the truth value of ∃xP(x) for∀x ∈ R?

2 Let P(x) be “x2 > 0”. What is the truth value of ∃xP(x) for∀x ∈ Z ?

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 17 / 28

Page 62: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Examples

Universal quantification

1 Let P(x) be “x + 1 > x”. What is the truth value of ∀xP(x) for∀x ∈ R?

Note that if the domain is empty, then ∀xP(x) is true for anypropositional function P(x) because there are no elements x in thedomain for which P(x) is false.

2 Let P(x) be “x2 > 0”. What is the truth value of ∀xP(x) for∀x ∈ Z ? (Note that x = 0 is a counterexample because x2 = 0.)

Existential quantification

1 Let P(x) denote “x > 3”. What is the truth value of ∃xP(x) for∀x ∈ R?

2 Let P(x) be “x2 > 0”. What is the truth value of ∃xP(x) for∀x ∈ Z ?

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 17 / 28

Page 63: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Remarks

When all the elements in the domain can be listed as x1, x2, · · · , xnUniversal quantification

∀xP(x) is the same as conjunction

P(x1) ∧ P(x2) ∧ · · · ∧ P(xn),

because this conjunction is true if and only if P(x1), P(x2), · · · ,P(xn) areall true.

Existential quantification

∃xP(x) is the same as disjunction

P(x1) ∨ P(x2) ∨ · · · ∨ P(xn),

since the disjunction is true if and only if at least one of P(x1),P(x2), · · · ,P(xn) is true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 18 / 28

Page 64: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Remarks

When all the elements in the domain can be listed as x1, x2, · · · , xnUniversal quantification

∀xP(x) is the same as conjunction

P(x1) ∧ P(x2) ∧ · · · ∧ P(xn),

because this conjunction is true if and only if P(x1), P(x2), · · · ,P(xn) areall true.

Existential quantification

∃xP(x) is the same as disjunction

P(x1) ∨ P(x2) ∨ · · · ∨ P(xn),

since the disjunction is true if and only if at least one of P(x1),P(x2), · · · ,P(xn) is true.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 18 / 28

Page 65: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers with restricted domains

Example

What do the statements ∀x < 0(x2 > 0) and ∃y > 0(y 2 = 2) mean, wherethe domain in each case consists of the real numbers?

1 The statement ∀x < 0(x2 > 0) states that for every real number xwith x < 0, x2 > 0, i.e., it states “The square of a negative realnumber is positive”. This statement is the same as∀x(x < 0→ x2 > 0).

2 The statement ∃y > 0(y 2 = 2) states “There is a positive squareroot of 2”, i.e., ∃y(y > 0 ∧ y 2 = 2).

Note that the restriction of a universal quantification is the same asthe universal quantification of a conditional statement.

On the other hand, the restriction of an existential quantification isthe same as the existential quantification of a conjunction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 19 / 28

Page 66: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers with restricted domains

Example

What do the statements ∀x < 0(x2 > 0) and ∃y > 0(y 2 = 2) mean, wherethe domain in each case consists of the real numbers?

1 The statement ∀x < 0(x2 > 0) states that for every real number xwith x < 0, x2 > 0, i.e., it states “The square of a negative realnumber is positive”. This statement is the same as∀x(x < 0→ x2 > 0).

2 The statement ∃y > 0(y 2 = 2) states “There is a positive squareroot of 2”, i.e., ∃y(y > 0 ∧ y 2 = 2).

Note that the restriction of a universal quantification is the same asthe universal quantification of a conditional statement.

On the other hand, the restriction of an existential quantification isthe same as the existential quantification of a conjunction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 19 / 28

Page 67: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers with restricted domains

Example

What do the statements ∀x < 0(x2 > 0) and ∃y > 0(y 2 = 2) mean, wherethe domain in each case consists of the real numbers?

1 The statement ∀x < 0(x2 > 0) states that for every real number xwith x < 0, x2 > 0, i.e., it states “The square of a negative realnumber is positive”. This statement is the same as∀x(x < 0→ x2 > 0).

2 The statement ∃y > 0(y 2 = 2) states “There is a positive squareroot of 2”, i.e., ∃y(y > 0 ∧ y 2 = 2).

Note that the restriction of a universal quantification is the same asthe universal quantification of a conditional statement.

On the other hand, the restriction of an existential quantification isthe same as the existential quantification of a conjunction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 19 / 28

Page 68: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers with restricted domains

Example

What do the statements ∀x < 0(x2 > 0) and ∃y > 0(y 2 = 2) mean, wherethe domain in each case consists of the real numbers?

1 The statement ∀x < 0(x2 > 0) states that for every real number xwith x < 0, x2 > 0, i.e., it states “The square of a negative realnumber is positive”. This statement is the same as∀x(x < 0→ x2 > 0).

2 The statement ∃y > 0(y 2 = 2) states “There is a positive squareroot of 2”, i.e., ∃y(y > 0 ∧ y 2 = 2).

Note that the restriction of a universal quantification is the same asthe universal quantification of a conditional statement.

On the other hand, the restriction of an existential quantification isthe same as the existential quantification of a conjunction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 19 / 28

Page 69: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Quantifiers with restricted domains

Example

What do the statements ∀x < 0(x2 > 0) and ∃y > 0(y 2 = 2) mean, wherethe domain in each case consists of the real numbers?

1 The statement ∀x < 0(x2 > 0) states that for every real number xwith x < 0, x2 > 0, i.e., it states “The square of a negative realnumber is positive”. This statement is the same as∀x(x < 0→ x2 > 0).

2 The statement ∃y > 0(y 2 = 2) states “There is a positive squareroot of 2”, i.e., ∃y(y > 0 ∧ y 2 = 2).

Note that the restriction of a universal quantification is the same asthe universal quantification of a conditional statement.

On the other hand, the restriction of an existential quantification isthe same as the existential quantification of a conjunction.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 19 / 28

Page 70: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Precedence of quantifiers and binding variables

Precedence of quantifiers

The quantifiers ∀ and ∃ have higher precedence than all logical operatorsfrom propositional calculus.

∀xP(x) ∧ Q(x) ≡ (∀xP(x)) ∧ Q(x), rather than ∀x(P(x) ∧ Q(x)).

∃xP(x) ∨ Q(x) ≡ (∃xP(x)) ∨ Q(x).

Bound and free

In statement ∃x(x + y = 1), variable x is bound by the existential quantifi-cation ∃x , but variable y is free because it is not bound by a quantifier andno value is assigned to this variable. This illustrates that in the statement,x is bound, but y is free.The part of a logical expression to which a quantifier is applied is called thescope of this quantifier. Consequently, a variable is free if it is outside thescope of all quantifiers in the formula that specify this variable.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 20 / 28

Page 71: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Precedence of quantifiers and binding variables

Precedence of quantifiers

The quantifiers ∀ and ∃ have higher precedence than all logical operatorsfrom propositional calculus.

∀xP(x) ∧ Q(x) ≡ (∀xP(x)) ∧ Q(x), rather than ∀x(P(x) ∧ Q(x)).

∃xP(x) ∨ Q(x) ≡ (∃xP(x)) ∨ Q(x).

Bound and free

In statement ∃x(x + y = 1), variable x is bound by the existential quantifi-cation ∃x , but variable y is free because it is not bound by a quantifier andno value is assigned to this variable. This illustrates that in the statement,x is bound, but y is free.The part of a logical expression to which a quantifier is applied is called thescope of this quantifier. Consequently, a variable is free if it is outside thescope of all quantifiers in the formula that specify this variable.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 20 / 28

Page 72: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Logical equivalences involving quantifiers

Definition

Statements involving predicates and quantifiers are logically equiva-lent if and only if they have the same truth value no matter whichpredicates are substituted into these statements and which domainof discourse is used for the variables in these propositional functions.We use the notation S ≡ T to indicate that two statements S andT involving predicates and quantifiers are logically equivalent.

Table of logical equivalence

equivalence name

∀x(P(x) ∧ Q(x)) ≡ ∀xP(x) ∧ ∀xQ(x) Distributive law

¬∀xP(x) ≡ ∃x¬P(x) Negation law¬∃xP(x) ≡ ∀x¬P(x)

¬∀x(P(x)→ Q(x)) ≡ ∃x(P(x) ∧ ¬Q(x))

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 21 / 28

Page 73: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Quantifiers

Logical equivalences involving quantifiers

Definition

Statements involving predicates and quantifiers are logically equiva-lent if and only if they have the same truth value no matter whichpredicates are substituted into these statements and which domainof discourse is used for the variables in these propositional functions.We use the notation S ≡ T to indicate that two statements S andT involving predicates and quantifiers are logically equivalent.

Table of logical equivalence

equivalence name

∀x(P(x) ∧ Q(x)) ≡ ∀xP(x) ∧ ∀xQ(x) Distributive law

¬∀xP(x) ≡ ∃x¬P(x) Negation law¬∃xP(x) ≡ ∀x¬P(x)

¬∀x(P(x)→ Q(x)) ≡ ∃x(P(x) ∧ ¬Q(x))

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 21 / 28

Page 74: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Applications of Quantifiers

Quantifiers in system specifications

Example

Use predicates and quantifiers to express the system specifications “Everymail message larger than one megabyte will be compressed” and “If a useris active, at least one network link will be available.”

Let S(m, y) be “Mail message m is larger than y megabytes,” wherevariable x has the domain of all mail messages and variable y is apositive real number, and let C (m) denote “Mail message m will becompressed.” Then “Every mail message larger than one megabytewill be compressed” can be represented as ∀m(S(m, 1)→ C (m)).

Let A(u) represent “User u is active,” where variable u has thedomain of all users, let S(n, x) denote “Network link n is in state x ,”where n has the domain of all network links and x has the domain ofall possible states for a network link. Then “If a user is active, atleast one network link will be available” can be represented by∃uA(u)→ ∃nS(n, available).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 22 / 28

Page 75: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Applications of Quantifiers

Quantifiers in system specifications

Example

Use predicates and quantifiers to express the system specifications “Everymail message larger than one megabyte will be compressed” and “If a useris active, at least one network link will be available.”

Let S(m, y) be “Mail message m is larger than y megabytes,” wherevariable x has the domain of all mail messages and variable y is apositive real number, and let C (m) denote “Mail message m will becompressed.” Then “Every mail message larger than one megabytewill be compressed” can be represented as ∀m(S(m, 1)→ C (m)).

Let A(u) represent “User u is active,” where variable u has thedomain of all users, let S(n, x) denote “Network link n is in state x ,”where n has the domain of all network links and x has the domain ofall possible states for a network link. Then “If a user is active, atleast one network link will be available” can be represented by∃uA(u)→ ∃nS(n, available).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 22 / 28

Page 76: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Applications of Quantifiers

Quantifiers in system specifications

Example

Use predicates and quantifiers to express the system specifications “Everymail message larger than one megabyte will be compressed” and “If a useris active, at least one network link will be available.”

Let S(m, y) be “Mail message m is larger than y megabytes,” wherevariable x has the domain of all mail messages and variable y is apositive real number, and let C (m) denote “Mail message m will becompressed.” Then “Every mail message larger than one megabytewill be compressed” can be represented as ∀m(S(m, 1)→ C (m)).

Let A(u) represent “User u is active,” where variable u has thedomain of all users, let S(n, x) denote “Network link n is in state x ,”where n has the domain of all network links and x has the domain ofall possible states for a network link. Then “If a user is active, atleast one network link will be available” can be represented by∃uA(u)→ ∃nS(n, available).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 22 / 28

Page 77: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.

For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 78: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 79: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 80: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 81: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 82: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 83: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Nested quantifiers

Definition

Nested quantifiers is one quantifier within the scope of another.For example, ∀x∃y(x + y = 0). Note that everything within thescope of a quantifier can be thought of as a propositional function.∀x∃y(x + y = 0) is the same thing as ∀xQ(x), where Q(x) is∃yP(x , y), where P(x , y) is x + y = 0.Please translate following nested quantifiers into statements

∀x∀y(x + y = y + x) for ∀x , y ∈ R.

∀x∃y(x + y = 0) for ∀x , y ∈ R.

∀x∀y∀z((x + y) + z = x + (y + z)) for ∀x , y , z ∈ R.

∀x∀y((x > 0) ∧ (y > 0)→ (xy < 0)) for ∀x , y ∈ R.

∀ε > 0∃δ > 0∀x(0 < |x − a| < δ → |f (x)− L| < ε).

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 23 / 28

Page 84: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Order of quantifiers

Order is important

It is important to note that the order of the quantifiers is important,unless all the quantifiers are universal quantifiers or all are existentialquantifiers.

Statement When True? When False?

∀x∀yP(x , y) P(x , y) is true There is a pair x , y for∀y∀xP(x , y) for every pair x , y which P(x , y) is false

∀x∃yP(x , y) For every x , there is a y There is an x such thatfor which P(x , y) is true P(x , y) is false for ∀y

∃x∀yP(x , y) There is an x for which For every x , there is a yP(x , y) is true for every y for which P(x , y) is false

∃x∃yP(x , y) There is a pair x , y P(x , y) is false∃y∃xP(x , y) for which P(x , y) is true for every pair x , y

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 24 / 28

Page 85: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Order of quantifiers

Order is important

It is important to note that the order of the quantifiers is important,unless all the quantifiers are universal quantifiers or all are existentialquantifiers.

Statement When True? When False?

∀x∀yP(x , y) P(x , y) is true There is a pair x , y for∀y∀xP(x , y) for every pair x , y which P(x , y) is false

∀x∃yP(x , y) For every x , there is a y There is an x such thatfor which P(x , y) is true P(x , y) is false for ∀y

∃x∀yP(x , y) There is an x for which For every x , there is a yP(x , y) is true for every y for which P(x , y) is false

∃x∃yP(x , y) There is a pair x , y P(x , y) is false∃y∃xP(x , y) for which P(x , y) is true for every pair x , y

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 24 / 28

Page 86: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Applications of nested quantifiers

Nested quantifiers translation

∀x(C (x) ∨ ∃y(C (y) ∧ F (x , y)))

C (x): x has a computer;

F (x , y): x and y are friends;

Domain for both x and y consists of all students in your school.

Solution:The statement says that for every student x in your school, x has acomputer or there is a student y such that y has a computer and xand y are friends.That is, every student in your school has a computer or has a friendwho has a computer.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 25 / 28

Page 87: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Applications of nested quantifiers

Nested quantifiers translation

∀x(C (x) ∨ ∃y(C (y) ∧ F (x , y)))

C (x): x has a computer;

F (x , y): x and y are friends;

Domain for both x and y consists of all students in your school.

Solution:The statement says that for every student x in your school, x has acomputer or there is a student y such that y has a computer and xand y are friends.

That is, every student in your school has a computer or has a friendwho has a computer.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 25 / 28

Page 88: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Applications of nested quantifiers

Nested quantifiers translation

∀x(C (x) ∨ ∃y(C (y) ∧ F (x , y)))

C (x): x has a computer;

F (x , y): x and y are friends;

Domain for both x and y consists of all students in your school.

Solution:The statement says that for every student x in your school, x has acomputer or there is a student y such that y has a computer and xand y are friends.That is, every student in your school has a computer or has a friendwho has a computer.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 25 / 28

Page 89: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Applications of nested quantifiers Cont’d

Sentence translation I

“If a person is female and is a parent, then she is someones mother”.Solution:∀x((F (x) ∧ P(x))→ ∃yM(x , y))

F (x): x is female;

P(x): x is a parent;

M(x , y): x is the mother of y ;

Sentence translation II

“There is a woman who has taken a flight on every airline in the world”.Solution:∃w∀a∃f (P(w , f ) ∧ Q(f , a))

P(w , f ): w has taken f ;

Q(f , a): f is a flight on a;

Or∃w∀a∃fR(w , f , a)

R(w , f , a): w has taken f on a.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 26 / 28

Page 90: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Applications of nested quantifiers Cont’d

Sentence translation I

“If a person is female and is a parent, then she is someones mother”.Solution:∀x((F (x) ∧ P(x))→ ∃yM(x , y))

F (x): x is female;

P(x): x is a parent;

M(x , y): x is the mother of y ;

Sentence translation II

“There is a woman who has taken a flight on every airline in the world”.Solution:∃w∀a∃f (P(w , f ) ∧ Q(f , a))

P(w , f ): w has taken f ;

Q(f , a): f is a flight on a;

Or∃w∀a∃fR(w , f , a)

R(w , f , a): w has taken f on a.

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 26 / 28

Page 91: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Negation of nested quantifiers

Example

Use quantifiers to express the statement that “There does not exist a womanwho has taken a flight on every airline in the world”

¬∃w∀a∃f (P(w , f ) ∧ Q(f , a))

P(w , f ): w has taken f ;

Q(f , a): f is a flight on a;

¬∃w∀a∃f (P(w , f ) ∧ Q(f , a)) ≡ ∀w¬∀a∃f (P(w , f ) ∧ Q(f , a))

≡ ∀w∃a¬∃f (P(w , f ) ∧ Q(f , a))

≡ ∀w∃a∀f ¬(P(w , f ) ∧ Q(f , a))

≡ ∀w∃a∀f (¬P(w , f ) ∨ ¬Q(f , a))

“For every woman there is an airline such that for all flights, this womanhas not taken that flight or that flight is not on this airline.”

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 27 / 28

Page 92: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Negation of nested quantifiers

Example

Use quantifiers to express the statement that “There does not exist a womanwho has taken a flight on every airline in the world”

¬∃w∀a∃f (P(w , f ) ∧ Q(f , a))

P(w , f ): w has taken f ;

Q(f , a): f is a flight on a;

¬∃w∀a∃f (P(w , f ) ∧ Q(f , a)) ≡ ∀w¬∀a∃f (P(w , f ) ∧ Q(f , a))

≡ ∀w∃a¬∃f (P(w , f ) ∧ Q(f , a))

≡ ∀w∃a∀f ¬(P(w , f ) ∧ Q(f , a))

≡ ∀w∃a∀f (¬P(w , f ) ∨ ¬Q(f , a))

“For every woman there is an airline such that for all flights, this womanhas not taken that flight or that flight is not on this airline.”

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 27 / 28

Page 93: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Nested Quantifiers

Negation of nested quantifiers

Example

Use quantifiers to express the statement that “There does not exist a womanwho has taken a flight on every airline in the world”

¬∃w∀a∃f (P(w , f ) ∧ Q(f , a))

P(w , f ): w has taken f ;

Q(f , a): f is a flight on a;

¬∃w∀a∃f (P(w , f ) ∧ Q(f , a)) ≡ ∀w¬∀a∃f (P(w , f ) ∧ Q(f , a))

≡ ∀w∃a¬∃f (P(w , f ) ∧ Q(f , a))

≡ ∀w∃a∀f ¬(P(w , f ) ∧ Q(f , a))

≡ ∀w∃a∀f (¬P(w , f ) ∨ ¬Q(f , a))

“For every woman there is an airline such that for all flights, this womanhas not taken that flight or that flight is not on this airline.”

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 27 / 28

Page 94: Discrete Mathematics and Its Applicationsdase.ecnu.edu.cn/mgao/teaching/DM_2020_Spring/slides/1... · 2020-02-24 · Outline 1 Logical Equivalences 2 Propositional Satis ability 3

Take-aways

Take-aways

Conclusion

Logic equivalences

Propositional satisfiability

Predicates

Quantifiers

Applications of predicates and quantifiers

Nested quantifiers

MING GAO (DaSE@ECNU) Discrete Mathematics and Its Applications Mar. 10, 2020 28 / 28