Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 27

MTH1114

Computer
Mathematics
Week3
Predicate Calculus
Mathematical Proofs
Predicate Logic (§1.3)
• Propositional logic treats simple propositions
(whole sentences) as atomic entities.
• In the sentence “The dog is sleeping”:
• The phrase “the dog” denotes the subject -
the object or entity that the sentence is
about.
• The phrase “is sleeping” denotes the
predicate - a property that is true of the
subject.
Subjects and Predicates
• Why distinguish subjects and predicates?
Alice is swimming
Bernard is swimming The same
Something can
Cythia is swimming action
swim
A dog is swimming

Subject: x Predicate (propositional function): P(.)

P(x) = “x is swimming” (where x is any object).


Propositional Functions
Propositional function (open sentence):
statement involving one or more variables,
e.g.: x-4 > 9.
Let us call this propositional function P(x), where P
is the predicate and x is the variable.

What is the truth value of P(5) ? false


What is the truth value of P(8) ? false
What is the truth value of P(15) ? true
4
Propositional Functions
Let us consider the propositional function
Q(s, t, w) defined as:
s + t = w.
Here, Q is the predicate and s, t, and w are the
variables.

What is the truth value of Q(2, 3, 5) ? true


What is the truth value of Q(0, 1, 2) ? false
What is the truth value of Q(9, -9, 0) ? true
5
Universal Quantification
Let P(x) be a propositional function.

Universally quantified sentence:


For all x in the universe of discourse P(x) is true.

Using the universal quantifier :


x P(x) “for all x P(x)” or “for every x P(x)”

(Note: x P(x) is either true or false, so it is a


proposition, not a propositional function.)

6
Universal Quantification
Example:
S(x): x is a Sunway student.
G(x): x is a genius.

What does x (S(x)  G(x)) mean ?

“If x is a Sunway student, then x is a genius.”


or
“All Sunway students are geniuses.”

7
Existential Quantification
Existentially quantified sentence:
There exists an x in the universe of discourse for
which P(x) is true.

Using the existential quantifier :


x P(x) “There is an x such that P(x).”
“There is at least one x such that P(x).”

(Note: x P(x) is either true or false, so it is a


proposition, but not propositional function.)

8
Existential Quantification
Example:
P(x): x is a Sunway lecturer.
G(x): x is a genius.

What does x (P(x)  G(x)) mean ?

“There is an x such that x is a Sunway lecturer and


x is a genius.”
or
“At least one Sunway lecturer is a genius.”

9
Quantification
Another example:
Let the universe of discourse be the real numbers.

What does xy (x + y = 640) mean ?

“For every x there exists a y so that x + y = 640.”

Is it true? yes

Is it true for the natural numbers? no

10
Disproof by Counterexample
A counterexample to x P(x) is an object c so that
P(c) is false.

Statements such as x (P(x)  Q(x)) can be


disproved by simply providing a counterexample.

Statement: “All birds can fly.”


Disproved by counterexample: penguin.

11
Negation

(x P(x)) is logically equivalent to x (P(x)).

(x P(x)) is logically equivalent to x (P(x)).

12
Quantification
Introducing the universal quantifier  and the
existential quantifier  facilitates the translation of
world knowledge into predicate calculus.

Examples:
John beats up all lecturers who fail him.
x([Lecturer(x)  Fails(x, John)]  BeatsUp(John, x))

All computer scientists are either rich or crazy, but not both.
x (CS(x)  [Rich(x)  Crazy(x)]  [Rich(x)  Crazy(x)] )
Or, using XOR:
x (CS(x)  [Rich(x)  Crazy(x)])
13
More About Predicates
• Convention: Lowercase variables x, y, z... denote
objects/entities; uppercase variables P, Q, R…
denote propositional functions (predicates).
• Note Applying a predicate P to an object x is the
proposition P(x).
• The predicate P itself (e.g. P = “is swimming”) is not a
proposition (not a complete sentence).
• e.g. let P(x,y,z) = “x gave y the grade z”,
then if x = “Ray”, y = “Mike”, z = “A”, then
P(x,y,z) = “Ray gave Mike the grade A.”
Universes of Discourse (U.D.s)
• Predicates can be applied to many objects at
once.
• The collection of values that a object variable x
can take is called x’s universe of discourse
(domain).
• Example: P(x,y,z) = “x gave y the grade z”

x : lecturer y : students z : grades


A
Dr Mike Hendri B

Dr Wong Tay Yong Hau C


Ahmad Yusof D
Dr Lim F
Translating from English

• Every student in this class has studied calculus


as a prerequisite.
• Let S(x) be “x is a student in this class”
• Let C(x) be “x has studied calculus as a
prerequisite”
• 
Universe of discourse is all people

x (S(x)  C(x))
MTH2102
Discrete Mathematics
Week4a
Introduction to Proofs &
Number Theory
Proving Theorems
Direct proof:
An implication pq can be proved by showing that if
p is true, then q is also true.

Example: Give a direct proof of the theorem


“If n is odd, then n2 is odd.”

Idea: Assume that the hypothesis of this implication


is true (n is odd). Then use rules of inference and
known theorems to show that q must also be true (n 2
is odd).
18
Proving Theorems

n is odd.

Then n = 2k + 1, where k is an integer.

Consequently, n2 = (2k + 1)2.


= 4k2 + 4k + 1
= 2(2k2 + 2k) + 1

Since n2 can be written in this form, it is odd.

19
Proving Theorems
Indirect proof:
An implication pq is equivalent to its contra-
positive q  p. Therefore, we can prove pq by
showing that whenever q is false, then p is also false.
Example: Give an indirect proof of the theorem
“If 3n + 2 is odd, then n is odd.”
Idea: Assume that the conclusion of this implication
is false (n is even). Then use rules of inference and
known theorems to show that p must also be false
(3n + 2 is even).
20
Proving Theorems
n is even.

Then n = 2k, where k is an integer.

It follows that 3n + 2 = 3(2k) + 2


= 6k + 2
= 2(3k + 1)

Therefore, 3n + 2 is even.

We have shown that the contrapositive of the


implication is true, so the implication itself is also true
(If 2n + 3 is odd, then n is odd).
21
Proof by contradiction
Given a statement p, assume it is false
– Assume ¬p

Prove that ¬p cannot occur


– A contradiction exists

Given a statement of the form p→q


– To assume it’s false, you only have to consider the
case where p is true and q is false
Proof by contradiction example 1
Theorem (by Euclid): There are infinitely many prime
numbers.

Proof. Assume there are a finite number of primes


List them as follows: p1, p2 …, pn.
Consider the number q = p1p2 … pn + 1
– This number is not divisible by any of the listed primes
• If we divided pi into q, there would result a remainder of 1
– We must conclude that q is a prime number, not among
the primes listed above
• This contradicts our assumption that all primes are in the list
p1, p2 …, pn.
Proof by contradiction example 2
Prove that if n is an integer and n3+5 is odd, then n is even
Rephrased: If n3+5 is odd, then n is even

Assume p is true and q is false


– Assume that n3+5 is odd, and n is odd
n=2k+1 for some integer k (definition of odd numbers)
n3+5 = (2k+1)3+5 = 8k3+12k2+6k+6 = 2(4k3+6k2+3k+3)
As 2(4k3+6k2+3k+3) is 2 times an integer, it must be even
Contradiction!
Counterexamples
Given a universally quantified statement, find a
single example which it is not true

Note that this is DISPROVING a UNIVERSAL


statement by a counterexample

x ¬R(x), where R(x) means “x has red hair”


– Find one person (in the domain) who has red hair

Every positive integer is the square of another


integer
– The square root of 5 is 2.236, which is not an integer
What’s wrong with this proof?
If n2 is an even integer, then n is an even
integer.

Proof:
Suppose n2 is even. Then n2 = 2k for some
integer k.
Let n = 2t for some integer t. Then n is an
even integer. (see example 18 for answer)
This argument is wrong. The statement “Let n = 2t
for some integer t.” occurs in the proof. No
argument has been given to show that n can be
written as 2t for some integer t. This is circular
reasoning because this statement is equivalent to
the statement being proved, namely “n is even”. Of
course, the result itself is correct, only the method
of proof is wrong.

27

You might also like