Download Document

Document related concepts
no text concepts found
Transcript
Discrete Mathematics
-- Chapter
Ch t 2:
2 F
Fundamentals
d
t l off
Logic
Hung-Yu Kao (高宏宇)
Department of Computer Science and Information Engineering,
N
National
l Cheng
Ch
Kung
K
University
U
Outline
z
z
z
z
z
Basic Connectives and Truth Tables
Logical Equivalence: The Law of Logic
Logical Implication: Rule of Inference
The Use of Quantifiers
Quantifiers Definitions
Quantifiers,
Definitions, and the Proofs of
Theorems
2009 Spring
Discrete Mathematics – CH2
2
The Way to Proof
證明”A君是萬能”這句話是錯的
z
(1)
(2)
(3)
A君可以搬動任何石頭
A君可以製造出他無法搬動的石頭
(1) (2) 相互矛盾,
(1),
相互矛盾 原命題為假
A logical sequence of statements.
2009 Spring
Discrete Mathematics – CH2
3
2.1 Basic Connectives and Truth Tables
z
z
Statement 敘述 (Proposition
S
(P
i i 命題):
命題) are declarative
d l i
sentences that are either true or false, but not both.
Primitive Statement (原始命題)
z
Examples
z p: ‘Discrete
Discrete Mathematics
Mathematics’ is a required course for sophomores.
z q: Margaret Mitchell wrote ‘Gone with the Wind’.
z r: 2+3=5.
z “What a beautiful evening!” (not a statement)
z ”Get up and do your exercises.” (not a statement)
z
No way to make them simpler
“The number x is an integer.”
g
is a statement ?
2009 Spring
Discrete Mathematics – CH2
4
2.1 Basic Connectives and Truth Tables
z
New statements can be obtained from primitive
statements in two ways
z
z
2009 Spring
Transform a given statement p into the statement ¬p,
which denotes its negation and is read “Not
Not p
p”. 非p
(Negation statements)
Combine two or more statements into a compound
statement, using logical connectives. (Compound
statements複合敘述)
Discrete Mathematics – CH2
5
2.1 Basic Connectives and Truth Tables
z
Compound Statement (Logical Connectives)
z
z
z
z
z
Conjunction:
j
p ‫ ר‬q (read “p and q”)
Disjunction : p v q (read “p or q”)
Exclusive or : p v q.
Implication: p → q,
p: hypothesis
“p
p implies q
q”.
q: conclusion
l i
Biconditional: p ↔ q
z
z
z
2009 Spring
“p
p if and only if q
q” (若且為若)
“p iff q”
“p
p is necessary and sufficient for q
q”.
Discrete Mathematics – CH2
p → q is also called
called,
• If p, then q
• p is sufficient for q
• p is a sufficient condition for q
• q is necessary for p
• q is a necessary condition for p
• p only if q
•q
q whenever p
6
2.1 Basic Connectives and Truth Tables
z
The truth and falsity of the compound statements based
on the truth values of their components (primitive
statements).
We do not want a true statement to lead
us into believing something that is false.
p
¬p
0
1
1
0
p
q
p ‫ר‬q
pvq
pvq
p→q
p↔q
0
0
1
1
0
1
0
1
0
0
0
1
0
1
1
1
0
1
1
0
1
1
0
1
1
0
0
1
Truth Tables
2009 Spring
Discrete Mathematics – CH2
7
Writing Down Truth Tables
z
“True, False” is preferred (less ambiguous) than “1, 0”
z
List the elementary truth values in a consistent way
(from F…F to T…T or from T…T to F…F).
z
They get long: with n variables, the length is 2n.
z
In the end we want to be able to reason about logic
without having to write down such tables.
2009 Spring
Discrete Mathematics – CH2
8
2.1 Basic Connectives and Truth Tables
z
z
z
p→q is equivalent with (¬p ∨ q)
It’s not relative about the causal relationship
z If Discrete Mathematics
Mathematics’ is a required course for sophomores, then
Margaret Mitchell wrote ‘Gone with the Wind’. is true
z If “2+3=5”, then “4+2=6” is true
z If “2+3=6”,
2 3 6 , then “2+4=7”
2 4 7 is true
“Margaret Mitchell wrote ‘Gone with
the Wind
Wind’(q), and 2+3 ≠ 5 (not r), the
‘Discrete Mathematics’ is a required
course for sophomores (p).
z
2009 Spring
1
2
3
q ∧ ( ¬r → p )
Discrete Mathematics – CH2
9
Implications examples
p: If it is sunny today,
today then we will go to the beach.
beach
q: If today is Friday,
Friday then 2+3=5.
2+3=5
r: If today is Friday, then 2+3=6.
r is true every day except Friday, even though 2+3=6 is false.
The M
Th
Mathematical
h
i l concept off an implication
i li i is
i independent
i d
d off a
cause-and-effect relationship between hypothesis and conclusion.
2009 Spring
Discrete Mathematics – CH2
10
2.1 Basic Connectives and Truth Tables
z
Ex 2.1: Let s, t, and u denote the primitive statements.
z
z
z
z
s: Phyllis goes out for a walk.
t: The moon is out.
out
u: It is snowing.
English sentences for compound statements.
z
Same?
z
z
2009 Spring
(t ‫¬ ר‬u) → s:
z If the
th moon is
i outt and
d it is
i nott snowing,
i then
th Phyllis
Ph lli goes outt for
f a walk.
lk
t → (¬u → s) :
z If the moon is out, then if it is not snowing Phyllis goes out for a walk.
¬ (s ↔ (u v t)) :
z It is not the case that Phyllis goes out for a walk if and only if it is
snowingg or the moon is out.
Discrete Mathematics – CH2
11
2.1 Basic Connectives and Truth Tables
z
Let s, t, and u denote the primitive statements.
z
z
z
z
s: Phyllis goes out for a walk.
t: The moon is out.
out
u: It is snowing.
Reversely,
R
l examine
i the
th logical
l i l form
f
for
f given
i
English
E li h sentences.
t
z “Phyllis will go out walking if and only if the moon is out.”
z
z
t
(u ‫¬ ר‬tt ) → ¬ s
It is snowing but Phyllis will still go out for a walk.
z
2009 Spring
↔
If it is snowing and the moon is not out, then Phyllis will not go out for
a walk.”
z
z
s
u‫ר‬s
Discrete Mathematics – CH2
12
2.1 Basic Connectives and Truth Tables
z
Ex 2.3:
z Decision ((selection)) structure
z
z
2009 Spring
In computer science, the if-then and if-then-else decision
structure arise in high-level programming languages such as
Java and C++.
E.g., “if p then q else r,” q is executed when p is true and r
i executedd when
is
h p is
i false.
f l
Discrete Mathematics – CH2
13
2.1 Basic Connectives and Truth Tables
z
Tautology, T0: If a compound statement is true for all
truth value assignments for its component statements.
z
z
Contradiction, F0: If a compound statement is false for
all truth value assignments for its component statements.
z
z
Example: p∨¬p
Example: p∧¬p
Examples
z
z
2009 Spring
“2 = 3–1” is not a tautology, but “2=1 or 2≠1” is;
“1+1=3” is not a contradiction, but “1=1 and 1≠1” is.
Discrete Mathematics – CH2
14
2.1 Basic Connectives and Truth Tables
z
An argument starts with a list of given
statements called premises (hypothesis) and a
statement called the conclusion of the argument.
z
2009 Spring
(p1‫ ר‬p2‫ר … ר‬pn) → q
Discrete Mathematics – CH2
15
2.2 Logical Equivalence: The Laws of Logic
z
Logically equivalent,s1 ⇔ s2 : When the statement s1 is
true (false) if and only if s2 is true (false).
¬p ∨ q ⇔ p → q
( p → q) ∧ (q → p) ⇔ p ↔ q
the same truth tables
2009 Spring
p
q
¬p
¬pvq
0
0
1
1
0
1
0
1
1
1
0
0
1
1
0
1
p→q q→p
1
1
0
1
( → q )‫ ( ר‬q → p))
(p
p↔q
1
0
0
1
1
0
0
1
1
0
1
1
Discrete Mathematics – CH2
16
2.2 Logical Equivalence: The Laws of Logic
z
Negation, v (exclusive)
2009 Spring
Discrete Mathematics – CH2
17
2.2 Logical Equivalence: The Laws of Logic
z
Logically equivalent examples
z
p ⇔ (p∨p)
z
z
¬¬p ⇔ p
z
z
z
2009 Spring
“1+1=2” ⇔ “1+1=2 or 1+1=2”
“He did not not do it” ⇔ “He did it”
¬(p∧q)
(p∧q) ⇔ ¬p∨¬q
p∨ q
“If p then not p” ⇔ “not p”
Discrete Mathematics – CH2
18
The Laws of Logic (1/2)
1) Law off Double
bl Negation
i : ¬¬p ⇔ p
⎧¬( p ∨ q ) ⇔ ¬p ∧ ¬q
2)DeMorgan
DeMorgan' s Laws : ⎨
⎩¬( p ∧ q ) ⇔ ¬p ∨ ¬q
⎧p ∨ q ⇔ q ∨ p
3) Commutative Laws : ⎨
⎩p ∧ q ⇔ q ∧ p
⎧ p ∨ (q ∨ r ) ⇔ ( p ∨ q) ∨ r
4) Associative Laws : ⎨
⎩ p ∧ (q ∧ r ) ⇔ ( p ∧ q) ∧ r
⎧ p ∨ (q ∧ r ) ⇔ ( p ∨ q) ∧ ( p ∨ r )
5) Distributive Laws : ⎨
⎩ p ∧ (q ∨ r ) ⇔ ( p ∧ q) ∨ ( p ∧ r )
2009 Spring
Discrete Mathematics – CH2
19
The Laws of Logic (2/2)
⎧p ∨ p ⇔ p
6) Idempotent Laws : ⎨
⎩p ∧ p ⇔ p
⎧ p ∨ F0 ⇔ p
7) Identity Laws : ⎨
⎩ p ∧ T0 ⇔ p
⎧ p ∨ ¬p ⇔ T0
8) Inverse Laws : ⎨
⎩ p ∧ ¬p ⇔ F0
⎧ p ∨ T0 ⇔ T0
9) Domination Laws : ⎨
⎩ p ∧ F0 ⇔ F0
⎧ p ∨ ( p ∧ q) ⇔ p
10) Absorption Laws : ⎨
⎩ p ∧ ( p ∨ q) ⇔ p
2009 Spring
Discrete Mathematics – CH2
20
2.2 Logical Equivalence: The Laws of Logic
z
¬( p ∧ q ) ⇔ ¬p ∨ ¬q
DeMorgan’s Laws:
¬( p ∨ q ) ⇔ ¬p ∧ ¬q
p q
0
0
1
1
0
1
0
1
2009 Spring
p‫ר‬q
¬(p ‫ ר‬q)
0
0
0
1
1
1
1
0
¬p ¬q ¬ p ∨ ¬ q p ∨ q ¬(p ∨ q)
1
1
0
0
1
0
1
0
1
1
1
0
0
1
1
1
Discrete Mathematics – CH2
1
0
0
0
¬p ‫ ¬ר‬q
1
0
0
0
21
The Principle of Duality
z
Definition 2.3: Let s be a statement. Dual of s, denoted sd, is the
statement obtained from s by replacing each occurrence of ∧ and
∨ by
b ∨ andd ∧, respectively,
ti l andd eachh occurrence off T0 andd F0 by
b
F0 and T0, respectively.
z
E.g.
g
s:
( p ∧ ¬q ) ∨ ( r ∧ T0 )
s d : ( p ∨ ¬q ) ∧ ( r ∨ F0 )
z
Keep negation!
The Principle of Duality: Let s and t be statements that contain
no logical connectives other than ∧ and ∨.
If s ⇔ t , then
th sd ⇔ td.
2009 Spring
Discrete Mathematics – CH2
22
Substitution Rules
z
Rule 1: Suppose that the compound statement P is a tautology.
z
z
If p is a primitive statement that appears in P and we replace each
occurrence off p by
b the
th same statement
t t
t q, then
th th
the resulting
lti
compound statement P1.is also a tautology.
Rule 2: Let P be a compound
p
statement where p is an arbitraryy
statement that appears in P, and let q be a statement such that q
⇔ p.
z
2009 Spring
Suppose that
S
h iin P we replace
l
one or more occurrences off p by
b q.
Then this replacement yields the compound statement P1. Under
these circumstances P1 ⇔ P.
Discrete Mathematics – CH2
23
Simplification of Compound Statements
z
Ex 2.10:
z From the first of DeMorgan’s Laws
P: ¬ (p ∨ q) ↔(¬p ∧¬q) is a tautology
z
from the first substitution rule
P1: ¬ [(r ∧ s) ∨ q] ↔ [¬(r ∧ s) ∧ ¬q] is also a
tautology
z
replace each occurrence of q by t →u
P2: ¬ [(r ∧ s) ∨ (t →u)] ↔[¬ (r ∧ s) ∧ ¬ (t →u)]
2009 Spring
Discrete Mathematics – CH2
24
Simplification of Compound Statements
z
Ex 2.11:
z P: (p → q) →r, and because (p → q) ⇔ ¬p ∨ q
z from the second substitution rule
if P1: (¬p ∨ q ) →r, then P1 ⇔ P
z
Check 2.11 (b) for another example using the second rule
z
2009 Spring
p →(p ∨ q), ¬ ¬ p ⇔ p
Discrete Mathematics – CH2
25
Simplification of Compound Statements
Ex 2.12:
z
z
1.
2.
3
3.
4.
5.
2009 Spring
Negate and simplify the compound statement (p ∨ q) → r
(p ∨ q) → r ⇔ ¬(p ∨ q) ∨ r (First substitution rule)
¬[(p ∨ q) → r] ⇔ ¬[¬(p ∨ q) ∨ r] (Negating)
¬[¬(p ∨ q) ∨ r] ⇔ ¬¬(p ∨ q) ∧ ¬r (DeMorgan
(DeMorgan’ss Laws)
¬¬(p ∨ q) ∧ ¬r ⇔ (p ∨ q) ∧ ¬r (Law of double Negation)
¬[(p
[(p ∨ q) → r]] ⇔ (p ∨ q) ∧ ¬r
Discrete Mathematics – CH2
26
Simplification of Compound Statements
z
Ex 2.13:
z
p: Joan goes to Lake George
q: Mary pays for Joan’s shopping spree.
p → q: If Joan goes to Lake George, then Mary will pay for
Joan’ss shopping spree.
Joan
The negation of p → q :
z
z
z
z
z
2009 Spring
One way: ¬ (p → q). It is not the case that if Joan goes to Lake
G
George,
th
then M
Mary will
ill pay for
f Joan’s
J
’ shopping
h
i spree.
Another way: p ∧ ¬ q. Joan goes to Lake George, but Mary does not
pay for Joan’s shopping spree.
¬( p → q )
⇔ ¬(¬p ∨ q)
⇔ ¬¬p ∧ ¬q
⇔ p ∧ ¬q
Discrete Mathematics – CH2
27
Relevant Statements to Implication
p
Statement
z
p
q
p→q
¬q→¬p
q→p
¬p→¬q
0
0
1
1
0
1
0
1
1
1
0
1
1
1
0
1
1
0
1
1
1
0
1
1
Ex 2.15:
p → q ⇔ (¬ q → ¬ p)
z q → p ⇔ (¬
( p → ¬ q))
Contrapositive of p → q : ¬ q → ¬ p
Converse of p → q : q → p
Inverse of p → q : ¬ p → ¬ q
z
z
z
z
2009 Spring
Discrete Mathematics – CH2
28
Simplification of Compound Statements
z
Ex 2.16: How to simply express the compound
statement (p ∨ q) ∧ ¬(¬p ∧ q)?
( p ∨ q ) ∧ ¬(¬p ∧ q )
Reasons
⇔ ( p ∨ q ) ∧ (¬¬p ∨ ¬q ) (DeMorgan' s Law)
⇔ ( p ∨ q ) ∧ ( p ∨ ¬q )
((Law of Double Negation)
g
)
2009 Spring
⇔ p ∨ ( q ∧ ¬q )
(Distributive Law of ∨ over ∧)
⇔ p ∨ F0
(Inverse Law)
⇔p
(Identity Law)
Discrete Mathematics – CH2
29
Simplification of Compound Statements
z
Ex 22.18:
18: A switching network is made up of wires and
switches connecting two terminals T1 and T2
•
p
p
p
q
t
¬tt
T1
r
¬q
p
•
•
T2
T1
r
•
t
T2
r
¬q
( p ∨ q ∨ r ) ∧ ( p ∨ t ∨ ¬q ) ∧ ( p ∨ ¬t ∨ r ) ⇔ p ∨ [r ∧ (t ∨ ¬q )] Practice!
P
i !
2009 Spring
Discrete Mathematics – CH2
30
Simplification of Compound Statements
(p ∨ q ∨ r) ∧ (p ∨ t ∨ ¬q) ∧ (p ∨ ¬t ∨ r)
⇔ p ∨ [(q ∨ r) ∧ (t ∨ ¬q) ∧ (¬t ∨ r)]
⇔ p ∨ [((q ∧ ¬t ) ∨ r) ∧ (t ∨ ¬q)]
⇔ p ∨ [((q ∧ ¬t ) ∨ r) ∧ ¬(¬t ∧ q)]
⇔ p ∨ [((q ∧ ¬tt ) ∧ ¬(¬t
( t ∧ q)) ∨ ((¬(¬t
( t ∧ q) ∧ r)]
⇔ p ∨ [F0 ∨ (¬(¬t ∧ q) ∧ r)]
p
⇔ p ∨ [r ∧ (t ∨ ¬q)]
•
T1
t
•
T2
r
¬q
2009 Spring
Discrete Mathematics – CH2
31
2.3 Logic Implication: Rules of Inference
z
z
Argument: ( p1 ∧ p2
Premiss: p1, p2,…, pn
Conclusion: q
∧⋅⋅⋅∧
pn ) → q
Ex 2.19:
z
z
z
z
z
z
z
2009 Spring
p: Roger studies
studies.
q: Roger plays racketball.
r: Roger passes discrete mathematics.
p1 : p → r
p1: Roger studies, then he will pass discrete mathematics.
p 2 : ¬q → p
p2: If Roger don
don’tt play racketball
racketball, then he
he’ll
ll study.
study
p3 : ¬ r
p3: Roger failed discrete mathematics.
Determine whether the argument ( p1 ∧ p 2 ∧ p3 ) → q is valid.
Discrete Mathematics – CH2
32
Logic Implication: Rules of Inference
z
z
Examine the truth table for the implication
p
[( p → r ) ∧ (¬q → p ) ∧ ¬r ] → q
p1
p2
p3
(p1 ‫ר‬p
p2‫ר‬p
p3) → q
p
q
r
p→r
¬q → p
¬r
[(p → r )‫¬( ר‬q → p) ‫¬ר‬r] → q
0
0
0
0
1
1
1
1
0
0
1
1
0
0
1
1
0
1
0
1
0
1
0
1
1
1
1
1
0
1
0
1
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
0
1
1
1
1
1
1
1
1
( p1 ∧ p2 ∧ p3 ) → q
2009 Spring
p1 : p → r
p 2 : ¬q → p
p3 : ¬ r
is a valid argument.
argument
Discrete Mathematics – CH2
33
Logic Implication: Rules of Inference
z
Definition 2.4: p logically implies q, p ⇒ q.
z
z
If p, q are arbitrary statements such that p → q is a tautology.
Rules of inference
z
z
Use instead of constructing the huge truth table
Using these techniques will enable us to consider only the
cases wherein all the premises are true.
Development of a step-by-step validation of how the
concl sion q logically
conclusion
logicall follows
follo s from the premises p1, p2,…, pn
in an implication of the form
( p1 ∧ p2
2009 Spring
∧⋅⋅⋅∧
pn ) → q
Discrete Mathematics – CH2
34
Logic Implication: Rules of Inference
z
Rule of Detachment (分離)
z
z
z
Modus Ponens: the method of affirming
Example:
[ p ∧ ( p → q)] → q
p
q
p→q
p ‫( ר‬p → q)
[p ‫( ר‬p → q)] → q
0
0
1
1
0
1
0
1
1
1
0
1
0
0
0
1
1
1
1
1
Tabular form:
therefore
2009 Spring
p
p→q
∴q
Discrete Mathematics – CH2
35
Logic Implication: Rules of Inference
z
Law of the Syllogism (演繹推理)
z Tabular form:
p→q
q→r
∴p→r
z
Modus Tollens: Method of Denying
z
Tabular form:
p→q
¬q
∴ ¬p
2009 Spring
Discrete Mathematics – CH2
36
Rules of
Inference
2009 Spring
Discrete Mathematics – CH2
37
Logic Implication: Rules of
Inference
Ex 2.30:
2009 Spring
Discrete Mathematics – CH2
38
Logic Implication: Rules of Inference
z
Ex 2.31:
z
z
z
z
If the band could not play rock music or the refreshments were
not delivered on time, then the New Year’s party would have
been cancelled and Alicia would have been angry.
If the party were cancelled, then refunds would have had to be
made.
No refunds were made.
Therefore the band could play rock music.
p: The band could play rock music.
q: The refreshments were delivered
on time
r: The New Year’s party was cancelled .
s: Alicia was angry.
t: Refunds had to be made
made.
2009 Spring
Discrete Mathematics – CH2
(¬ p ∨ ¬q ) → ( r ∧ s )
r→t
¬t
∴p
39
Logic Implication: Rules of Inference
( ¬p ∨ ¬q ) → ( r ∧ s )
r →t
Steps
(1) r → t
Reasons
Premise
(2) ¬t
(3) ¬r
(4) ¬r ∨ ¬s
Premise
(1) and (2), and Method of Denying
(3) andd Rule
R l off Disjunctiv
Di j
i e Amplificat
A lifi ion
i
(5) ¬(r ∧ s )
(6) (¬p ∨ ¬q) → (r ∧ s )
(4) and DeMorgan' s Laws
Premise
(7) ¬(¬p ∨ ¬q )
(8) p ∧ q
(6) and (5), and Method of Denying
(7) , DeMorgan' s Laws, and Law of Double Negation
(9) ∴ p
(8) and Rule of Conjunctive Simplification
2009 Spring
Discrete Mathematics – CH2
¬t
∴p
40
Proof by Contradiction
z
Ex 2.35:
z
z
2009 Spring
Is the right argument valid or invalid?
Let conclusion ¬p be false (the argument invalid)
⇒ p is true
⇒ q is true
⇒ s is true
⇒ r is false
⇒ r is
i true
t
(¬p∨r,
(
now p is
i true)
t )
⇒ contradiction
⇒ argument is valid
Discrete Mathematics – CH2
41
Interesting examples
z
A. 考前猜題
z
z
z
z
習題A 1, A
習題A-1
A-2兩題中必出一題
2兩題中必出 題, 但不會兩題都
出
習題A-2和A-3兩題要嘛都出
習題A
2和A 3兩題要嘛都出, 要嘛都不出
如果不出A-1, 也不會出A-3
請問哪 題會出哪 題不會出?
請問哪一題會出哪一題不會出?
A-1出, A-2不出, A-3不出
2009 Spring
Discrete Mathematics – CH2
42
Interesting examples
z
B. 誰是兇手
z
角頭老大A死了, 警方請來他幫派裡兩位二哥
角頭老大A死了
級人物B和C來協助瞭解死因。
z
z
z
警方不知B C供詞真偽 但可以確定的是
警方不知B,C供詞真偽,
z
z
z
z
2009 Spring
B說: 如果A被謀殺, 那肯定是C幹的
C說: 如果A不是自殺, 那就是被謀殺
A死因只有三種: 意外, 自殺和謀殺
如果B和C都沒有說謊 那A就死於
如果B和C都沒有說謊,
那A就死於一場意外
場意外
如果B和C兩人中有一人說謊, 那麼A就不是死於
意外
請問A的死因為何?
Ans: 謀殺, B說謊
Discrete Mathematics – CH2
43
2.4 The Use of Quantifiers
z
Definition 2.5: A declarative sentence is an open statement if
z
z
z
z
z
z
it contains one or more variables, and
it is not a statement, but
it becomes a statement when the variables in it are replaced by
certain allowable choices.
E.g.,
z p(x): The number x+2 is an even integer
integer.
z q(x, y): The number y+2, x - y, and x+2y are even integers.
z For some x, p(x). For some x, y, q(x, y).
z For some x,
x ¬p(x).
p(x) For some x,
x y,
y ¬q(x,
q(x y).
y)
Existential quantifier: ∃x , “for some x”, “for at least one x” or
“th exists
“there
i t an x suchh that”
th t”
Universal quantifier: ∀x , “for all x”, “for any x” “for every x” or
“for each x such that”
2009 Spring
Discrete Mathematics – CH2
44
The Use of Quantifiers
z
Ex 2.36:
z
z
z
z
2009 Spring
2
p
(
x
)
:
x
≥
0
,
q
(
x
)
:
x
≥0
Given the open statements
r ( x) : x 2 − 3 x − 4 = 0, s ( x) : x 2 − 3 > 0
The statement ∀x [ p ( x ) → q ( x )] is true
z For every real number x, if x ≥ 0, then x2 ≥ 0.
z Every nonnegative real number has a nonnegative square.
z The square of any nonnegative real number is a nonnegative
reall number.
b
z All nonnegative real numbers have nonnegative squares.
The statement ∃x [ p ( x) ∧ r ( x)] is true.
The statement ∀x [ q ( x ) → s ( x )] is false.
Discrete Mathematics – CH2
Counterexample!
45
Summarization
¬∃x: P(x)
(x) v.s. ∃x: ¬P(x)
(x)
¬∀x: P(x) v.s. ∀x: ¬P(x)
2009 Spring
Discrete Mathematics – CH2
46
The Use of Quantifiers
z
For open statements p(x), q(x), the universally
quantified statement ∀x[p(x) → q(x)], we define
z
z
z
2009 Spring
Contrapositive: ∀x[¬q(x) → ¬p(x)]
Converse: ∀x[q(x) → p(x)]
Inverse: ∀x[¬p(x) → ¬q(x)]
Discrete Mathematics – CH2
47
Logical
g
Equivalence
q
and Implication
p
for
Quantified Statements
∃x [ p ( x) ∧ q ( x)] ⇒ [∃x p ( x) ∧ ∃x q ( x)]
∃x [ p ( x) ∨ q ( x)] ⇔ [∃x p ( x) ∨ ∃x q ( x)]
∀x [ p ( x) ∧ q ( x)] ⇔ [∀x p ( x) ∧ ∀x q ( x)]
[∀x p ( x) ∨ ∀x q ( x)] ⇒ ∀x [ p ( x) ∨ q ( x)]
2009 Spring
Discrete Mathematics – CH2
48
The Use of Quantifiers
z
Rules for negating statements with one quantifier
¬[∀x p ( x )] ⇔ ∃x¬p ( x )
¬[∃x p ( x )] ⇔ ∀x¬p ( x )
¬[∀x ¬p ( x )] ⇔ ∃x¬¬ p ( x ) ⇔ ∃x p ( x )
¬[∃x ¬p ( x )] ⇔ ∀x¬¬ p ( x ) ⇔ ∀x p ( x )
2009 Spring
Discrete Mathematics – CH2
49
Commuting Quantifiers
Identical quantifiers commute:
∃x∃y: P(x,y) ⇔ ∃y∃x: P(x,y) and
∀x∀y: P(x,y)
P(x y) ⇔ ∀y∀x: P(x,y)
P(x y)
But non-identical ones do not, see:
∃x∀y:
y x=y
y v.s. ∀y∃x:
y
x=yy
2009 Spring
Discrete Mathematics – CH2
50
The Use of Quantifiers
z
Ex 2.49:
z
What is the negation of the following statement?
∀x ∃y [( p ( x, y ) ∧ q ( x, y )) → r ( x, y )]
¬[∀x ∃y [( p ( x, y ) ∧ q ( x, y )) → r ( x, y )]]
⇔ ∃x [¬∃ y [( p ( x, y ) ∧ q ( x, y )) → r ( x, y )]]
⇔ ∃x ∀y¬ [( p ( x, y ) ∧ q ( x, y )) → r ( x, y )]
⇔ ∃x ∀y¬ [¬[ p ( x, y ) ∧ q ( x, y )] ∨ r ( x, y )]
⇔ ∃x ∀y[[¬ ¬[ p ( x, y ) ∧ q ( x, y )] ∧ ¬r ( x, y )]
⇔ ∃x ∀y[ p ( x, y ) ∧ q ( x, y )] ∧ ¬r ( x, y )]
2009 Spring
Discrete Mathematics – CH2
51
2.5 Quantifiers,, Definitions,, and the
Proofs of Theorems
z
Ex 2.52:
z
z
show that for all n, n=2, 4, 6,…,24, 26, we can write n as the
sum off at most three
h perfect
f squares.
Exhaustion method
2=1+1
4 4
4=4
6=4+1+1
8=4+4
8
4+4
2009 Spring
10=9+1
12 4 4 4
12=4+4++4
14=9+4+1
16=16
16
16
18=16+1+1
20=16+4
22 9 9 4
22=9+9+4
24=16+4+4
26=25+1
26
25+1
Discrete Mathematics – CH2
52
Quantifiers,, Definitions,, and the Proofs
of Theorems
z
The R
Th
Rule
l off U
Universal
i
lS
Specification:
ifi ti
If an open statement
becomes true for all replacements by the members in a given
universe, then that open statement is true for each specific
individual member in that universe.
if ∀x p (x) is true, then p ( x ) is true for each a in the universe.
z
2009 Spring
Eg
E.g.
∀x [ m( x ) → c ( x )]
m(a )
∴ c (a
(a)
Steps
Reasons
(1) ∀x[m( x) → c( x)]
Premise
(2) m(a)
(3) m(a) → c(a)
Premise
(1) and the rule of Universal Specification
(4) ∴ c(a)
( )
((2)) and ((3)) and the Rule of Detachment
Discrete Mathematics – CH2
53
Quantifiers,, Definitions,, and the Proofs
of Theorems
z
The R
Th
Rule
l off U
Universal
i
l Generalization:
G
li ti
If an open statement p(x)
( )
is proved to be true when x is replaced by any arbitrarily chosen
element c from our universe, then the universally quantified
statement ∀x p(x) is true. Furthermore, the rule extends beyond a
single variable.
z
Ex 2.56:
∀x [ p ( x) ∨ q ( x)]
∀x [(¬p ( x) ∧ q ( x)) → r ( x)]
∴ ∀x [¬r ( x) → p ( x)]
2009 Spring
[¬r ( x) → ¬(¬p ( x) ∧ q ( x))]
[¬r ( x) → p ( x) ∨ ¬q ( x))]
Discrete Mathematics – CH2
54
Quantifiers, Definitions, and the
Proofs of Theorems ∀x [ p( x) ∨ q( x)]
z
2009 Spring
Ex 2.56:
∀x [(¬p ( x) ∧ q ( x)) → r ( x)]
∴ ∀x [¬r ( x) → p ( x)]
Discrete Mathematics – CH2
55
Quantifiers,, Definitions,, and the Proofs
of Theorems
z
Argument
∀x [( j ( x ) ∨ s ( x )) → ¬p ( x )]
p (m)
∴ ¬s (m
(m)
z
Establish the validity of this argument
• No junior or senior is enrolled in
a physical education class.
• Mary is enrolled in a physical
education class.
• Thus Mary is not a senior.
Steps
Reasons
1) ∀x [ j ( x) ∨ s ( x) → ¬p( x)]
Premise
2) p (m)
Premise
3) j (m) ∨ s (m) → ¬p (m)
(1) and Rule of Universal Specification
4) p (m) → ¬( j (m) ∨ s (m))
(3), (q → t ) ⇔ (¬t → ¬q) and
Law of Double Negation
5) p (m) → (¬j (m) ∧ ¬s (m))
(4) and DeMorgan' s Law
6) ¬ j ( m ) ∧ ¬ s ( m )
(2) and (5) and Rule of Detachment
7 ) ∴ ¬s ( m )
(6) and Rule of Conjunctive Simplification
2009 Spring
Discrete Mathematics – CH2
56
Quantifiers,, Definitions,, and the Proofs
of Theorems
z
D fi iti 2.8:
Definition
28
z
z
Let n be an integer. We call n even if n is divisible by 2, that is, if
there exists an integer r so that n = 2r. If n is not even, then we call
n odd and find for this case that there exists an integer s where n =
2s +1.
Theorem 2.2:
2 2: For all integers k and l,
l if k and l are both odd,
odd then
k + l is even.
z
1.
2.
3.
2009 Spring
Proof
Si
Since
k andd l are odd,
dd we may write
i k = 2a+1
2 1 andd l = 2b+1,
2b 1 for
f some
integers a, b. (the Rule of Universal Specification)
Then k + l = (2a+1)+(2b+1) = 2(a+b+1), which hold for integers.
(apply Commutative
Commutative, Associative
Associative, and Distributive Laws)
Since a, b are integers, a+b+1 = c is an integer; with k + l = 2c, so k
+ l is even.
Discrete Mathematics – CH2
57
Quantifiers,, Definitions,, and the Proofs
of Theorems
z
Theorem 2.3: For all integers k and l, if k and l are both
odd, then kl is also odd.
z
2009 Spring
Proof?
Discrete Mathematics – CH2
58
Quantifiers,, Definitions,, and the Proofs
of Theorems
Theorem 2.4: If m is an even integer, then m + 7 is odd.
z
z
1.
2.
3.
2009 Spring
Proof
Since m is even, we have m = 2a for some integer a. Then m + 7 =
2a + 7 = 2a + 6 +1 = 2(a + 3) + 1. since a+3 is an integer, we know
that m + 7 is odd.
Suppose
pp
that m + 7 is not odd, hence even. Then m + 7 = 2b for
some integer b, and m = 2b – 7 = 2b – 8 +1 = 2(b – 4) +1, where
b – 4 is an integer. Hence m is odd. (contraposition method)
Assume that m is even and m + 7 is also even. Then m + 7 even
i li that
implies
th t m + 7 = 2c
2 for
f some integer
i t
c. Consequently,
C
tl m = 2c
2 –
7 = 2c – 8 +1 = 2(c – 4) +1 with c – 4 an integer, so m is odd. Now
we have contradiction. So the assumption is false (m + 7 is even),
and we have m + 7 odd. (contradiction method)
Assumption
Result Derived
Contraposition
¬q(m)
¬p(m)
Contradiction
p(m) and ¬q(m)
F0
Discrete Mathematics – CH2
59
Proof
Prove (p and ¬ q) is false Î prove (¬p or q) is true
2009 Spring
Discrete Mathematics – CH2
60
Quantifiers,, Definitions,, and the Proofs
of Theorems
Theorem 2.5:
z
z
z
For all positive real numbers x and y,
y if the product xy
exceeds 25, then x > 5 or y > 5.
Proof: (Contrapositive)
z
z
2009 Spring
Suppose that 0 < x ≤ 5 and 0 < y ≤ 5 (¬q(x, y))
We find that 0 = 0.0 < x. y ≤ 5.5 = 25 (¬p(x, y))
Discrete Mathematics – CH2
61
Exercise
z
z
z
z
z
2.1: 10
2 2: 16,
2.2:
16 20
2.3: 10
2.4: 14
2 5: 16
2.5:
2009 Spring
Discrete Mathematics – CH2
62
Related documents