The Foundations Logic and Proofs - New
The Foundations Logic and Proofs - New
The Foundations Logic and Proofs - New
CPCS 222
Discrete Structures I
The Foundations: Logic and Proofs
2
Propositional Logic
In this algebra,
the variables stand for unknown
propositions (instead of unknown real
numbers) and
the operators are and, and or,
or not,
not implies,
implies
and if and only if (rather than plus, minus,
negative, times, and divided by).
Just as middle/high school students learn
the notation of algebra and how to manipulate
it properly, we want to learn the notation of
propositional logic and how to manipulate it
properly. 3
Propositional Logic
A proposition is a declarative statement that’s
either true (T) or false (F), but not both
Propositions
Every cow has 4 legs
Riyadh is the capital of Saudi Arabia
1+1=2
2+2=3
Not Propositions
What time is it?
X+1=2
Answer this question 4
Propositional Logic
New propositions, called compound propositions
are formed from existing propositions using
logical Operators
5
Propositional Logic negation
Suppose p is a proposition
The negation of p is written as p and
has meaning:
“It is not the case that p.”
p p
Truth table for the
negation of proposition F T
p T F
6
Propositional Logic negation
“ today is Friday”
“ it is not the case that today is Friday” or
“today is not Friday”
“it is not Friday today”
7
Propositional Logic conjunction
Suppose p and q are propositions
The conjunction of p and q is written as pq
p q pq
Truth table for the F F F
Conjunction of two F T F
propositions T F F
pq
T T T
8
Propositional Logic conjunction
p is the proposition “Today is Friday”
q is the proposition “It is raining today”
This proposition
Is true on rainy Fridays
Is false on any day that is not a Friday
on Fridays when it does not rain
9
Propositional Logic disjunction
Inclusive Or
Suppose p and q are propositions
The disjunction of p and q is written as pq
p q pq
Truth table for the
F F F
Disjunction (Inclusive Or)
of two propositions F T T
pq T F T
T T T 10
Propositional Logic disjunction
p is the proposition “Today is Friday”
q is the proposition “It is raining today”
This proposition
Is true on any day that is either a Friday
or a rainy day(including rainy Fridays)
Is false on days that are not Fridays when
it also does not rain
11
Propositional Logic disjunction
Exclusive Or
Suppose p and q are propositions
The Exclusive Or of p and q is written as pq
p q pq
Truth table for the
Exclusive Or of two F F F
propositions F T T
pq T F T
(pq) (pq) T T F 12
Propositional Logic disjunction
Exclusive Or
“Tonight I will stay home or go out to a movie.”
movie
13
Propositional Logic implication
Suppose p and q are propositions
The conditional statement (implication)
implication pq
The proposition pq is read “ if p, then q”
q
P hypothesis – antecedent – premise
q conclusion -consequence
p q pq
Truth table for the F F T
Implication F T T
pq T F F
p q
T T T 14
Propositional Logic implication
Terminology used to express pq
“if p, then q”
“p is sufficient for q”
“q if p” “q when p”
“a necessary condition for p is q”
“q unless p“
“p implies q”
“p only if q”
“a sufficient condition for q is p”
“q whenever p”
“q is necessary for p”
“q follows from p”
“if p, q”
15
Propositional Logic implication
p is the proposition “Ahmed learns discrete
mathematics”
q is the proposition “Ahmed will find a good job”
The pq is proposition
“ if Ahmed learns discrete mathematics, then he
will find a good job”
This proposition
Is false when p is true and q is false
Otherwise it is true
16
Propositional Logic implication
p is the proposition “today is Friday”
q is the proposition “2+3=5”
The pq is proposition
“ if today is Friday, then 2+3=5”
This proposition
Is true because its p q pq
Conclusion (q) is true “
F F T
F T T
T F F
T T T 17
Propositional Logic implication
p is the proposition “today is Friday”
q is the proposition “2+3=6”
The pq is proposition
“ if today is Friday, then 2+3=6”
This proposition
Is true every day p q pq
except Friday
F F T
F T T
T F F
T T T 18
Propositional Logic implication
The conditional statement (implication) pq
“if it is raining, then the home team wins”
p q p q
Truth table for the F F T
Bi-implication F T F
p q T F F
(p q ) ( p q )
T T T 20
Propositional Logic bi-implication
The proposition p q has the same truth value
as pq qp
21
Propositional Logic bi-implication
p is the proposition “You can take the flight”
q is the proposition “You buy a ticket”
The p q is proposition
“You can take the flight if and only if You buy a
ticket”
This proposition
Is true if p and q are either both true or both
false”
22
Propositional Logic
Truth table of compound propositions
Precedence of logical operators
23
Propositional Logic
Truth table of compound propositions
25
Propositional Logic
Translating English sentence into a logical
expression (System specifications)
Translating sentences in natural language
into logical expressions is an essential part of
specifying both hardware and software
systems.
System and software engineers take
requirements in natural language and produce
precise and unambiguous specifications that
can be used as the basis for system
development.
26
Propositional Logic
Translating English sentence into a logical
expression (System specifications)
Express the specification ”The automated
reply cannot be sent when the file system is
full“ using logical connectives.
P: “The automated reply can be sent”
q: “The file system is full”
q p
System specifications should be consistent
They should not contain conflicting
requirements that could be used to drive a27
contradiction
Propositional Logic
Translating English sentence into a logical
expression (System specifications)
determine whether these system specifications
are consistent :
“The diagnostic message is stored in the buffer or it is
retransmitted”
“The diagnostic message is not stored in the buffer”
“if the diagnostic message is stored in the buffer,
then it is retransmitted”
P: “The diagnostic message is stored in the buffer”
q: “The diagnostic message is retransmitted”
p q p pq
28
Propositional Logic
Translating English sentence into a logical
expression (System specifications)
p q p pq
p q p p q p q
F F T F T
F T T T T
T F F T F
T T F T T
p q p p q p q q
F F T F T T
F T T T T F
T F F T F T
T T F T T F
system specifications are inconsistent
31
Propositional Logic
Boolean Searches
Logical connectives are used extensively in
searches of large collections of information:
Indexes of Web pages, these searches
employ techniques from propositional logic.
The connective
AND is used to match records that contain
both of the two search items.
OR is used to match one or both of two
search items.
NOT is used to exclude a particular search
item (- is used in Google). 32
Propositional Logic
Logic Puzzles
puzzles that can be solved using logical
reasoning are known as logic puzzles.
33
Propositional Logic
Logic Puzzles
Let:
p: “A is a knight“ q: “B is a knight“
p : “ A is a knave” q: “ B is a knave”
A says “B is a knight”
q
B says “ the two of us are opposite”
(p q) ( p q)
If A is a knight
Then q is true and (p q) ( p q) is true
But (p q) ( p q) is false
We can conclude that A is a knave
34
Propositional Logic
Logic Puzzles
Let:
p: “A is a knight“ q: “B is a knight“
p : “ A is a knave” q: “ B is a knave”
A says “B is a knight”
q
B says “ the two of us are opposite”
(p q) ( p q)
If B is a knight (q is true)
Then (p q) ( p q) is true and q is false
We can conclude that B is a knave
0 1 1 0 1 1 0 1 1 0
1 1 0 0 0 1 1 1 0 1
Bitwise OR 1 1 1 0 1 1 1 1 1 1
Bitwise AND 0 1 0 0 0 1 0 1 0 0
Bitwise XOR 1 0 1 0 1 0 1 0 1 1 36
Chapter 1 Exercises
Pages (16-20)
1,3,6,7,9,10
12-14 (b,c)
15,17
20,22,24,25,26
27-33 (e)
36-38
48
50
37
Propositional Equivalences
Logical equivalences
compound propositions that have the same
truth values in all possible cases are called
Logically equivalent
Compound propositions p and q are Logically
equivalent if pq is a tautology.
logical equivalence
Note and are not logical
operators(connectives). Rather they indicate
a kind of logical equality.
39
Propositional Equivalences
40
Propositional Equivalences
Identity laws p T p p F p
Domination laws p F F p T T
Idempotent laws p p p p p p
Double negation law (p) p
Negation laws p p T p p F
Absorption laws p(pq) p p(p q) p
Commutative laws p q q p p q q p
Associative laws (pq)r p(qr) (pq)r p(qr)
De Morgan’s laws (pq) pq (pq) pq
Distributive laws p(qr) (pq)(pr)
p(qr) (pq)(pr)
T denotes the compound proposition that is always true
F denotes the compound proposition that is always false41
Propositional Equivalences
p q p q (p q) p q
p q q p
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
p q (p q) (q p)
p q p q
p q (p q ) ( p q )
(p q) p q
42
Propositional Equivalences
Use De Morgan’s law to express the negation
of “Ahmed has a mobile and he has a laptop”
p: “Ahmed has a mobile”
q: “Ahmed has a laptop”
p q
(pq) p q
p: “Ahmed has not a mobile”
q: “Ahmed has not a laptop”
“Ahmed has not a mobile or he has not a
laptop”
43
Propositional Equivalences
44
Chapter 1 Exercises
Pages (28-30)
1(a,b,f)
4(b)
7,8
9(a,f)
11(a,f)
15
26,27
45
Predicates and Quantifiers
Predicates
“x is greater than 3”
This statement is neither true nor false when the
value of the variable is not specified.
This statement has two pats
The fist part (subject) is the variable x
The second (predicate) is “is greater than 3”
We can denote this statement by P(x)
Where P denotes the predicate “is greater than
3”
Once a value has been assigned to x, the
statement P(x) becomes a proposition and has a
truth value. P is called Proposition function. 46
Predicates and Quantifiers
Predicates
P(x1,x2,x3,………,xn)
P is called n-place(n-ary) predicate.
47
Predicates and Quantifiers
Predicates
49
Predicates and Quantifiers
Universal quantification
Which tell us that a predicate is true for every
element under consideration.
existential quantification
Which tell us that there is one or more element
under consideration for which the predicate is
true.
50
Predicates and Quantifiers
The universal quantification of P(x) is the
statement “P(x) for all values of x in the domain”
∀x P(x) read as “for all x P(x)”
“for every x P(x)”
∀ is called universal quantifier
∀x P(x)
When true P(x) is true for every x.
When false there is an x for which P(x) is false.
∃x P(x)
When true there is an x for which P(x) is true.
When false P(x) is false for every x.
52
Predicates and Quantifiers
Let Q(x) “x<2”
What is the truth value of ∀x Q(x) when the
domain consists of all real numbers?
53
Predicates and Quantifiers
Let Q(x) “x2>0”
What is the truth value of ∀x Q(x) when the
domain consists of all integers?
54
Predicates and Quantifiers
What is the truth value of ∀x (x2 x) when the
domain
a) consists of all real number?
b) consists of all integers?
55
Predicates and Quantifiers
Let Q(x) “x>3”
What is the truth value of ∃x Q(x) when the
domain consists of all real numbers?
56
Predicates and Quantifiers
Let Q(x) “x=x+1”
What is the truth value of ∃x Q(x) when the
domain consists of all real numbers?
57
Predicates and Quantifiers
When all the elements in the domain can be listed
x1, x2 ,x3, x4, ……., xn
58
Predicates and Quantifiers
Let Q(x) “x2<10”
What is the truth value of ∀x Q(x) when the
domain consists of the positive integers not
exceeding 4?
59
Predicates and Quantifiers
Let Q(x) “x2>10”
What is the truth value of ∃x Q(x) when the
domain consists of the positive integers not
exceeding 4?
60
Predicates and Quantifiers
If domain consists of n (finite) object and we
need to determine the truth value of
∀x Q(x)
Loop through all n values of x to see if Q(x) is always
true
If you encounter a value x for which Q(x) is false,
exit the loop with ∀x Q(x) is false
otherwise ∀x Q(x) is true
∃x Q(x)
Loop through all n values of x to see if Q(x) is true
If you encounter a value x for which Q(x) is
true, exit the loop with ∃x Q(x) is true
Otherwise ∃x Q(x) is false 61
Predicates and Quantifiers
You can define other quantifiers, for example
“there are exactly two”
“there are at least 100”
Uniqueness quantifier ∃! ∃1
“there exists a unique x such that P(x) is true”
“there is exactly one”
“there is one and only one”
Precedence of quantifiers
∀ ∃ have higher precedence than all logical
operators
62
Quantifiers with restricted domain
What do these statements mean (domain real)
63
Binding variables
∃x (x+y=1)
The variable x is bounded by the existential
quantification ∃x and the variable y is free
66
Logical equivalence involving quantifiers
∀x (P(x) Q(x)) ∀x P(x) ∀x Q(x)
67
Negating quantified expression
“Every student in your class has taken a course in
calculus” ∀x P(x)
Where, P(x) is “x has taken a course in calculus”
and the domain consists of the student in your
class
Negation
“It is not the case that every student in your
class has taken a course in calculus”
or
“There is a student in your class who has not
taken a course in calculus” ∃x P(x)
∀x P(x) ∃x P(x)
68
Negating quantified expression
“There is a student in this class who has taken a
course in calculus” ∃x Q(x)
Where, Q(x) is “x has taken a course in calculus”
and the domain consists of the student in your
class
Negation
“It is not the case that there is a student in this
class who has taken a course in calculus”
or
“Every student in this class has not taken a
course in calculus” ∀x Q(x)
“Not all students in this class have taken a course in calculus” is not
used. ∃x Q(x) ∀x Q(x) 69
Negating quantified expression
Show that (homework)
∀x P(x) ∃x P(x)
∃x P(x) ∀x P(x)
70
Negating quantified expression
De Morgan’s laws for quantifiers
∃x P(x) ∀x P(x)
The negation is true when for every x, P(x) is
false
The negation is false when there is an x for
which P(x) is true
∀x (x2>x)
∃x (x2=x)
∀x (x2>x)
∀x (x2>x) ∃x (x2>x) ∃x (x2x)
∃x (x2=x)
∃x (x2=x) ∀x (x2=x) ∀x (x2x)
73
Negating quantified expression
Show that
∀x [P(x) Q(x)] ∃x [P(x) Q(x)]
74
Translating from English into Logical
Expressions
Express the statement “Every student in the class has
studied calculus” using predicates and quantifiers.
∀x (S(x) C(x))
78
Translating from English into Logical
Expressions
System specifications
Express the statement “If a user is active, at least one
network link will be available” using predicates and
quantifiers.
∀x∃y (x+y=0)
81
Nested Quantifiers
Translate into English
∀x∀y( (x>0) (y<0) (xy<0))
The domain of both x and y are real number.
For all x
For all y
P(x,y) all are true at least one is true
End for all y for all x and y in y loop and all x
End for all x
82
Nested Quantifiers
Thinking of quantification as a loops
∃x ∀y P(x,y)
For all y
For all x
P(x,y) at least one is true in x loop and all y
End for all x
End for all y
∃x∃y P(x,y)
For all x
For all y
P(x,y) at least one is true
End for all y
End for all x 83
Nested Quantifiers
The order of quantifiers
Suppose that the universe for x and y is {1, 2, 3}.
Also, assume that P(x, y) is a predicate that is
true in the following cases, and false otherwise: P(1, 3),
P(2, 1), P(2, 2), P(3, 1), P(3, 2), P(3, 3). Determine
whether each of the following is true or false:
(a) ∀y∃x (xy ∧ P(x, y)).
(b) ∀x∃y (xy ∧ ¬P(x, y)).
(c) ∀y∃x (xy ∧¬P(x, y)).
true
False.
False.
84
Nested Quantifiers
Translate the following statements into logical
expression
“the sum of two positive integers is always positive”
∀x∀y( (x>0) (y>0) (x+y>0))
Or
∀x∀y(x+y>0),
where the domain of both x and y consists of all positive
integers.
85
Nested Quantifiers
Translate the statements into English
∀x(C(x) ∃y(C(y) F(x,y) ))
where C(x) is “x has a computer”
F(x,y) is “x and y are friends”
the domain for both x and y consists of
all student in your school.
87
Negating Nested Quantifiers
Negate this statement( no negation precedes a
quantifier)
∀x ∃y (xy=1)
(∀x ∃y (xy=1))
∃x ∃y (xy=1)
∃x ∀y (xy=1)
∃x ∀y (xy1)
88
Chapter 1 Exercises
Pages (58-62)
1
4
6
11
24
26
29
31
39
45
89
Rules of Inference
90
Rules of Inference
An argument in Propositional logic is a sequence
of propositions. All but the final proposition in
the argument are called premises and the final
proposition is called the conclusion.
91
Rules of Inference
An argument form in Propositional logic is a
sequence of compound propositions involving
propositional variables.
p
“if you have a current password,
then you can log onto the network” q
“you have a current password”
Therefore,
“you can log onto the network”
p q
p
q
92
Rules of Inference
Valid arguments in Propositional logic
An argument is valid if the truth of all its
premises implies that the conclusion is true.
93
Rules of Inference
We can use a truth table to show that an
argument form is valid. By showing that
whenever the premises are true, the conclusion
must also be true. p q
p
q
p q pq (p
(p q) p (p(p
(p q)) q
F F T F T
F T T F T
T F F F T
T T T T T 94
Rules of Inference
We can use a truth table to show that an
argument form is valid. By showing that
whenever the premises are true, the conclusion
must also be true.
95
Rules of Inference
instead of using a truth table to show that an
argument form is valid, we cant use Rules of
inference.
The tautology (p (p
(p q))q is the basis of the
rule of inference called Modus Ponens ( or law
of detachment- mode that affirms)
p q
p
q
The hypotheses are written in a column, followed
by horizontal bar,followed by the and the
conclusion.
96
Rules of Inference
Modus Ponens
p
p q
q
Modus Ponens tell us that if a conditional
statement and its hypothesis are both true,
then the conclusion must also be true.
97
Rules of Inference
Modus Ponens
conditional statement
“if you have a current password,
then you can log onto the network”
hypothesis
“you have a current password”
if conditional statement and hypothesis are true
98
Rules of Inference
Modus Ponens (Example)
“if ,then “
“if ,then “
Hypothesis 1
Hypothesis 2 …
conclusion “” means “therefore”
101
Rules of Inference
Corresponding tautology:
((Hypoth. 1) (Hypoth. 2) …) conclusion
102
Rules of Inference
Some Inference Rules
p Rule of Addition
p q
“It is below freezing now. Therefore, it is
either below freezing or raining now.”
103
Rules of Inference
p
q
pq Rule of Conjunction
104
Rules of Inference
q
pq Rule of modus tollens
p (mode of denying) 105
Rules of Inference
p q Rule of disjunctive
p syllogism
q
106
Rules of Inference
p q Rule of Resolution
p r
q r
107
Rules of Inference
108
Rules of Inference
Examples
State which rule of inference is the basis of
the following argument:
“it is below freezing now (p). Therefore, it is
either below freezing or raining now (q).”
this argument is of the form
p
p q
This argument uses the addition rule
109
Rules of Inference
Examples
State which rule of inference is the basis of
the following argument:
“it is below freezing now(p) and raining
now(q) . Therefore, it is below freezing now.”
this argument is of the form
p q
p
This argument uses the simplification rule
110
Rules of Inference
Examples
State which rule of inference is the basis of the
following argument:
if it rains today(p), then we will not have a
barbecue today(q). if we do not have a barbecue
today, then we will have a barbecue
tomorrow(r) . Therefore, it is rains today,then
we will have a barbecue tomorrow.
this argument is of the form p q
q r
p r
This argument uses the hypothetical syllogism
rule 111
Using Rules of Inference to Build
Arguments
A formal proof of a conclusion C, given
premises p1, p2,…,pn consists of a sequence of
steps, each of which applies some inference rule
to premises or to previously-proven statements
(as hypotheses) to yield a new true statement
(the conclusion).
113
Using Rules of Inference to Build
Arguments
Example: (we can use the truth table)
Premises p q , r p, r s, s t
Conclusion t
Step Reason
1. p q Hypothesis
2. p Simplification using (1)
3. r p Hypothesis
4. r Modus Tollens using (2) (3)
5. r s Hypothesis
6. s Modus ponens using (4) (5)
7. s t Hypothesis
8. t Modus ponens using (6) (7)114
Common Fallacies
Is this argument is valid?
If you do every problem in this book, then you will learn
discrete mathematics(q). You learned discrete
mathematics.” Therefore, you did every problem in this
book(p).
this argument is of the form
pq and q then p . This is an example of an incorrect
argument using the Fallacy of affirming the conclusion:
pq and q does not imply p
The proposition [(p
(p q)q)p] is not a tautology (its false
if p is F and q is T)
You can learn discrete mathematics in some way other
than doing every problem in this book (by reading-
listening to lectures-doing some(but not all) the problems
in this book )
115
Common Fallacies
Is this argument is valid?
If you do every problem in this book(p), then you will
learn discrete mathematics(q). you did not do every
problem in this book. Therefore, You did not learn
discrete mathematics.”
this argument is of the form
pq and p imply q . This is an example of an incorrect
argument using the Fallacy of denying the hypothesis :
pq and p does not imply q
The proposition [(p
(p q)p)q] is not a tautology (its
false if p is F and q is T)
It is possible that you learned discrete even you did not
do every problem in this book
116
Common Fallacies
• A fallacy is an inference rule or other proof
method that is not logically valid.
– May yield a false conclusion!
• Fallacy of affirming the conclusion:
– “pq is true, and q is true, so p must be
true.” (No, because FT is true.)
• Fallacy of denying the hypothesis:
– “pq is true, and p is false, so q must be
false.” (No, again because FT is true.)
117
Inference Rules for Quantifiers
Universal instantiation
x P(x)
P(c) (substitute any object c)
We can conclude that P(c) is true, where c
is a particular member of the domain, if
we know that x P(x) is true.
Example
“all students have internet account”
“Ahmed has internet account”
Where, Ahmed is a member of the domain
Of all students 118
Inference Rules for Quantifiers
• Existential instantiation
x P(x)
P(c) (for some element c)
119
Inference Rules for Quantifiers
• Universal generalization
• P(c) (for an arbitrary c)
x P(x)
• Existential generalization
• P(c) (for some element c )
x P(x)
120
Inference Rules for Quantifiers
Show that the premises “Everyone in this discrete math
class has taken a course in computer science” and “Ali is
a student in this class” imply the conclusion “Ali has taken
a course in computer science”
D(x): “x is in discrete math class”
C(x): “x has taken a course in computer science”
x (D(x) C(x)) Premise #1
D(Ali) Premise #2
C(Ali)
Step Reason
1. x (D(x) C(x)) Premise #1
2. D(Ali) C(Ali) Univ. instantiation.
3. D(Ali) Premise #2.
4. C(Ali) Modus ponens on 2,3.
121
Inference Rules for Quantifiers
Show that the premises “A student in this class has not
read the book” and “Everyone in this class passed the
first exam” imply the conclusion “Someone who passed the
first exam has not read the book”
C(x): “x is in this class” x(C(x) B(x))
B(x): “x has read the book” x (C(x) P(x))
P(x): “x passed the first exam” x(P(x) B(x))
Step Reason
1. x(C(x) B(x)) Premise #1.
2. C(a) B(a) Exist. instantiation.
3. C(a) Simplification on 2.
4. x (C(x) P(x)) Premise #2.
5. C(a) P(a) Univ. instantiation.
6. P(a) Modus ponens on 3,5
7. B(a) Simplification on 2
8. P(a) B(a) Conjunction on 6,7
9. x(P(x) B(x)) Exist. generalization 122
Combining Rules of Inference for
Propositions and Quantified Statements
Universal Modus Ponens Inference Rule
x (P(x) Q(x))
P(a)
Q(a)
x (P(x) Q(x))
Q(a)
P(a)
125
Introduction to Proofs
Some terminology
Theorem
Is a statement that can be shown to be true.
Axioms (postulates)
Statements that used in a proof and are assumed
to be true.
126
Proof Methods
Proving pq
Direct proof: Assume p is true, and prove q.
Indirect proof: Assume q, and prove p.
Trivial proof: Prove q true.
Vacuous proof: Prove p is true.
127
Proof Methods (Direct proof)
Proving pq Direct proof: Assume p is true, and prove q
Definition: The integer n is even if there exists an
integer k such that n=2k, and n is odd if there exists an
integer k such that n=2k+1.
Axiom: Every integer is either odd or even.
Theorem: (For all numbers n) If n is an odd integer,
then n2 is an odd integer.
Proof:
If n is odd, then n = 2k+1 for some integer k.
Thus, n2 = (2k+1)2 = 4k2 + 4k + 1 = 2(2k2 + 2k) + 1.
Therefore n2 is of the form 2j + 1 (with j the integer 2k2
+ 2k), thus n2 is odd.
128
Proof Methods (Direct proof)
Proving pq Direct proof: Assume p is true, and prove q
Direct proofs lead from the hypothesis of a theorem to
the conclusion.
They begin with the premises, continue with a sequence of
deductions, and ends with the conclusion.
A direct proof often reach dead ends.
Example
Prove that if n is an integer and 3n+2 is odd,
then n is odd.
Examples
Theorem: (For all n) If n is both odd and even,
then n2 = n + n.
Proof: The statement “n is both odd and even” is
necessarily false, since no number can be both
odd and even. So, the theorem is vacuously true.
132
Proof Methods (Trivial proof)
Proving pq
Trivial proof: Prove q true.
Examples
Theorem: (For integers n) If n is the sum of two
prime numbers, then either n is odd or n is even.
Proof: Any integer n is either odd or even. So
the conclusion of the implication is true
regardless of the truth of the hypothesis.
Thus the implication is true trivially.
133
Proof Methods (Example)
Definition: The real number r is rational if there exist
integers p and q with q≠0 such that r=p/q. A real number
that is not rational is called irrational.
Theorem: Prove that the sum of two rational numbers is
rational.
Proof: assume that r and s are rational numbers
r=p/q and s=t/u where p,q,t,u are integers and p≠0, u≠0
r+s=(p/q)+(t/u) = (pu+qt)/(qu)
Because p≠0 and u≠0 , then qu≠0
Both (pu+qt) and (qu) are integers
Then the theorem is proved
•Proving p is true
Assume we can find a contradiction q such that
(pq) is true.
Because q is false and (pq) is true, we can conclude
that p is false, which means that p is true.
135
Proof Methods (Proof
( by Contradiction)
Example
Give a proof by contradiction of the theorem “if 3n+2 is
odd, then n is odd”
Proof
Let p be “3n+2 is odd“ and q be “n is odd“
We assume that both p and q are true
q “n is even“
3n+2=3(2k)+2=6k+2=2(3k+2)=2t even
this means p is false (p is true)
But we assume that both p and q are true
Then we have a contradiction
1-3
5-6
16-18
137
Proof Methods and Strategy
•Exhaustive proof and proof by cases
Sometimes we cannot prove a theorem using a single
argument that holds for all possible cases. In this
situation we consider each case separately.
To prove (p1 p2 p3 ……… pn) q
The following tautology can be used as a rule of
inference:
[(p1p2p3…pn)q] [(p1q)(p2q)(p3q)… (pnq)]
So we need to prove
(p1 q) (p2 q) (p3 q) ……… (pn q)
This argument is called a proof by cases
Some theorem can be proved by examining a relatively
small number of examples, such proof is called exhaustive
proof(special type of proof by cases) 138
Proof Methods and Strategy
Exhaustive proof (example)
• Disproof that (n+1)2 3n if n is a positive integer
with n4
139
Proof Methods and Strategy
Proof by cases (example)
• Proof that if n is an integer, then n2 n
To proof that n2 n for every integer, we will consider
three cases:
Case 1: n=0 02=0, we see that 02 0.
It follows that n2 n is true in this case.
Case 2: n 1 multiply both sides of the inequality n 1
by n we have n.n 1.n = n2 n
It follows that n2 n is true in this case.
Case 3: n -1 However n2 0, it implies n2 n
141
Proof Methods and Strategy
Proof by cases (example)
• Prove that the following is true for all real numbers
x and y: max(x, y) = 0.5 (x + y + |x − y|)
The absolute value function is used in this equation, its
value depends on whether the number is negative or
nonnegative. two cases are considered:
Case 1: (x −y < 0) this means (x < y)
0.5(x + y + |x − y|) = 0.5(x + y − (x − y))
= 0.5(x + y + y − x) = 0.5(2y) = y.
But if x < y, then we also have max(x, y) = y.
Case 2: (x − y ≥ 0 ) this means (x ≥ y)
0.5(x + y + |x − y|) =0.5(x + y + (x − y))
=0.5(x + y + x − y) = 0.5(2x) = x.
But if x ≥ y, then we also have max(x, y) = x.
Thus, in both cases we have 142
max(x, y) = 0.5 (x + y + |x − y|)
Exercises
pp(102-103)
1
3-5
143