Topic 1 Logic and Proof
Topic 1 Logic and Proof
AND PROOF
Semester 1 Session 2020/2021
1.1 LOGIC
Objectives:
Students should be able to:
Simple Compound
A simple statement is A compound statement is
such as: a combination of two or
a) Kuala Lumpur is the more simple statements.
capital of Malaysia
b) 5>6
Connectives (1/5)
•There
are five common connectives:
2. Conjunction
Example 3: Let p be the statement “They are talking” and q be the statement
“The door is closed”. Write the conjunction statement.
Solution: The conjunction statement (denoted by p q) is “They are talking and
the door is closed”.
Connectives (3/5)
• Disjunction
3.
Example 4: Let p be the statement “A policeman has to cross a river using a small boat”
and q be the statement “A thief has to cross a river using a small boat” Write the
disjunction statement.
Solution: The disjunction statement (denoted by p q) is “Either a policeman or a thief has
to cross a river using a small boat”.
4. Implication
Example 5: Let p be the statement “You participate in class” and q be the statement “You
will get extra points”. Write the implication statement p q.
Solution: The implication statement p q is “If you participate in class then you will get
extra points”.
Connectives (4/5)
The implication statement is also called the conditional statement. In
the “If…then” statements, the “if-part” is called the antecedent while
the “then-part’ is called the consequent. Other ways to say “If you
participate in class then you will get extra points” are
Universal Existential
“For
“For all”
all” or
or “There
“There exists
exists a”
a” or
or
“For every” ”There is a” or
“There
“There is
is at
at least
least one”
one”
Quantifiers (4/5)
•Universal
• symbols:
Some
N: Set of positive integers = {1, 2, 3, 4, 5, 6, …,
Example 7: Let P(x) be “x is even” 100, 101, 102, …}
Express the following statement in
symbolic form. R: Set of real numbers = ()
“For all integer x, x is even”
Z: Set of integers = {…, -2000, -1999, -1998,
-1997, -1996, …, 0, 1, 2, 3, 4, …, 1996, 1997, …}
Solution: x Z, P(x).
Q: Set of rational numbers = any numbers that
can be written as where and are integers with
.
Quantifiers (5/5)
•Existential
• symbols:
Some
N: Set of positive integers = {1, 2, 3, 4, 5, 6, …,
Example 8: Let Q(x) be “x < 4”. 100, 101, 102, …}
Express the following statement in
symbolic form. R: Set of real numbers = ()
“There is a real number x such
that x <4” Z: Set of integers = {…, -2000, -1999, -1998,
-1997, -1996, …, 0, 1, 2, 3, 4, …, 1996, 1997, …}
a) Today is raining Statement. The truth value depends on whether or not it is raining today.
b) For every real number x, x > 2 Statement. False. There exist a real number x such that x 2.
Not a statement
c) x 3
Not a statement
d) Please open that door
Statement. The truth value depends on whether you are a good student or
e) I am a good student not.
Statement. True.
f) There is a positive integer x such that x 2
Exercises 1 (2/2)
2. Express each statement in symbolic form.
p q (p = my parents are out of town,
q = my parents are visiting my sick neighbor)
a) Either my parents are out of town or visiting my sick neighbour
b) If it rains, then he will not come p q (p = it rains, q = he will come)
c) I will score A if and only if I study hard p q (p = I will score A, q = I study hard)
d) For all integer a, 2a – 1 is odd a Z, P(a) (P(a) = 2a - 1 is odd)
e) There is a real number y such that 2099 < y < 2100
y R, Q(y) (Q(y) = 2099 < y < 2100)
Truth Tables
Truth tables are tables giving all possible truth values of statements.
Assertion
Proposition
Truth Tables - Negation
A statement and its negation have opposite truth values.
p p
T F
F T
Truth Tables - Conjunction
•A conjunction p q is True only when p and q are both True.
2n=8
p q pq
T T TT=T
T F T=F
F T FT=F
F F F=F
p q r pqr
T T T T=T
T T F T=F
T F T T= F
T F F pqr
Truth Tables - Disjunction
•A disjunction p q is False only when p and q are both False.
p q pq
T T T
T F T
F T T
F F F
Truth Tables - Implication
•Implication
p q is only False when q is False given that p is True.
(pq) = pq
p q pq
T T T
T F F
F T T
F F T
p q p q (pq) pq
T T F F (T) =T FT=T
T F F T (T) = F F=F
F T T F (F) = T TT=T
F F T T (F) = T T=T
Truth Tables – Bi-conditional
•Bi-conditional
p q is True when p and q are both True or are both False.
p q pq
T T T
T F F
F T F
F F T
p q pq qp (pq) (qp)=
pq
TT TT TT TT T T=T
T F F T FT=F
T F F T
F T T F T =F
F T T F
Logically Equivalent (1/3)
•
Two compound statements are called logically equivalent if they have
the same truth value every possible truth value assignment to the
component statements.
p q p q pq q p
T T F F T T
T F F T F F
F T T F T T
F F T T T T
Logically Equivalent (3/3)
•
Step 2: Compare the truth values
• say we have theorem which is conditional form pq. Outline of direct proof is given
Let
by
Theorem: Statement “pq“
Proof: Suppose “p”
.
Proposition p is a written
verification that shows that
.
the theorem pq is definitely
. true.
Therefore “q”.
From the outline, firstly we assume that p is True. By using this assumption and other
mathematical knowledge, we prove that q is also True.
Direct Proof (2/4)
•“It
is a way of showing the truth or falsehood of a given statement by a
straightforward combination of established facts, usually axioms,
existing lemmas and theorems.”
p: x is odd
q: x2 is odd
Statement: “pq“
theorem
Direct Proof (4/4)
Step 2: Use Direct Proof outline to prove the statement.
Proof: Suppose “x is odd”. p
Since x is odd, x can be written as
x=2k+1 where k is an integer
x2=(2k+1)(2k+1)
= 4k2+4k+1
=2(2k2+2k)+1 m is an
integer
2k2+2k is an integer, say 2k2+2k=m.
x2 can also be written as x2=2m+1.
Therefore, “x2 is odd”.
Back to
Example 8
Contrapositive: negating
•pq is logically equivalent to q p. You may verify this by using a truth table.
Outline of contrapositive proof is given by
Theorem: Statement “pq”
Proof: Suppose “q” p q p q pq q p
T T F F TT=T FF=T
.
T F F T TF=F TF=F
. F T T F FT=T FT=T
. F F T T FF=T TT=T
Therefore “p”.
From the outline, firstly we assume that q is True. By using this assumption and
other mathematical knowledge, we prove that p is also True.
Contrapositive Proof (2/3)
•Example
2: Prove that if x2-6x+5 is even then x is odd.
Solution:
Implication statement
Solution:
Step 1: Write the statement in symbol
p: x2 – 6x + 5 is even
q: x is odd
Statement: “p q”
Proof by Contradiction (4/9)
Step 2: Use Proof by Contradiction outline to prove the statement.
Proof: Suppose the statement “if x2 – 6x + 5 is even then x is odd” is
False.
This is logically equivalent to x2 – 6x + 5 is even and x is even.
Since x is even, x can be written as
x = 2k, k is an integer pq pq
x2 – 6x + 5 = (2k)2 – 6(2k) + 5
= 4k2 – 12k + 4 + 1
= 2(2k2 – 6k + 2) + 1
Proof by Contradiction (5/9)
2. Inductive step
Prove “P(k)P(k+1)” is True using Direct Proof method.
Proof by Mathematical Induction (2/18)
• 2. Inductive step
Prove “P(k)P(k+1)” is True using Direct Proof method.
So, the outline is
Suppose “P(k)”
.
.
Therefore “P(k+1)”
P(1) is True.
P(k) P(k+1) is True.
Therefore P(x) is True for all x N.
Proof by Mathematical Induction (3/18)
•Example
5: Prove that 1 + 3 + 5 + 7 + …+ (2n – 1) = n2 for all n N.
Solution:
Step 1: Write the statement in symbol.
P(n):1+3+5+7+…+(2n-1)=n2
Statement: “n N, P(n)”
Note that the predicate P(n) is an equation where the left side of the
equation is a series, while the right side of the equation is the sum of
the series (i.e. n2).
Proof by Mathematical Induction (4/18)
P(n): 1+3+5+7+…+(2n-1) = n2
Suppose “1+3+5+7+…+(2k-1)=k2”
1+3+5+7+…+(2k-1)+(2(k+1)-1) = k2+(2(k+1)-1)
P(k+1), left =k2+2k+2-1
side
=k2+2k+1
=(k+1)2
Therefore “1+3+5+7+…+(2k-1)+(2(k+1)-1) = (k+1)2
Proof by Mathematical Induction (6/18)
•
P(1) is True.
P(k)P(k+1) is True.
Therefore P(n) is True for all n N.
Proof by Mathematical Induction (7/18)
•Example
6: Concerning the Fibonacci sequence, prove that for all positive integers
n.
Solution:
The Fibonacci Sequence is the sequence of numbers:
1, 1, 2, 3, 5, 8, 13, 21, 34, …
Fourth term
=1+2=3
Fifth term
=2+3=5
So, nth term .
Proof by Mathematical Induction (9/18)
•
Step 1: Write the statement in symbol.
P(n):
Predicate P(n) is
an equation with
left and right side
Statement: “”.
Proof by Mathematical Induction (10/18)
•Step
2: of the principle of mathematical induction to prove the statement.
Proof: P(n):
1. P(1):
To prove P(1) is True, we must show that the left side of P(1) is equal to the
right side of P(1).
Left side:
Right side:
1, 1, 2, 3, 5, 8, 13,
Therefore, Left side = Right side 21, 34, …
Hence, P(1) is True.
Proof by Mathematical Induction (11/18)
•2. P(k):
P(k+1):
Predicate
P(k) Predicate
Suppose “” P(k+1)
To prove P(k+1), we must show that the left side of P(k+1) is equal to
the right side of P(k+1).
Left side:
Right side:
Proof by Mathematical Induction (12/18)
Fibonacci
concept
•Left
side:
Factorise
Right side: & P(k)
Therefore, “”
Proof by Mathematical Induction (13/18)
•Example
7: Prove that 1+22+32+4+ …+n2 = for all nN.
Solution:
Step 1: Write the statement in symbol
Right side
of P(k+1)
P(k)p(k+1) is True
Solution:
This statement is a bi-conditional.
Let p: n is odd
q: n2 is odd
The statement can be written as: pq
:pqq p
Proof by Mathematical Induction (17/18)
•Thus,
we must prove
1. If n is odd then n2 is odd – using Direct Proof method
2. If n2 is odd then n is odd – using Contrapositive Proof method
Solution:
3. Refer to Example 1
4. Prove q p by using Contrapositive Proof method
Proof by Mathematical Induction (18/18)
•Step
1: Write statement in symbol
Statement “q p ”
Step 2: Negating p, p
1. P(1): , is True
2. P(k):
P(k+1):
Suppose “” is True
Exercise 1.2 (3/4)
•
Step 1: p:
q:
(pq)pq
Statement: pq
Which contradicts
Step 2: Proof pq is false the (pq)
Suppose “”
, is contradicts with
Therefore, is True.