Proposition Predicate
Proposition Predicate
Logic!
1
11/14/2020
Logic
Crucial for mathematical reasoning
Important for program design
Used for designing electronic circuitry
2
11/14/2020
“y > 5”
3
11/14/2020
Is this a proposition? no
4
11/14/2020
Is this a statement? no
It’s a request.
Is this a proposition? no
5
11/14/2020
Combining Propositions
6
11/14/2020
Negation (NOT)
P P
true (T) false (F)
false (F) true (T)
7
11/14/2020
Exercises
P: It rained on July 4, 1983
P: It didn’t rain on July 4, 1983
Conjunction (AND)
Binary Operator, Symbol:
P Q P Q
T T T
T F F
F T F
F F F
8
11/14/2020
Exercises
P: It is snowing
Q: It is dark outside
P Q:
It is snowing and dark outside
(P Q):
Either it is not snowing or it is dark outside
Disjunction (OR)
Binary Operator, Symbol:
P Q P Q
T T T
T F T
F T T
F F F
9
11/14/2020
Exercises
P: The roof is red
Q: The wall is white
P Q:
The roof is red or the wall is white (or both)
Exclusive Or (XOR)
Binary Operator, Symbol:
P Q PQ
T T F
T F T
F T T
F F F
10
11/14/2020
Exercises
P: I shall sleep tonight
Q: I shall study whole night
P Q:
I shall sleep tonight or I shall study whole night
(but not both)
11
11/14/2020
Exercises
Conditional statement
To understand the logic behind the truth table for the conditional statement,
consider the following statement.
“If you get an A in the class, I will give you five bucks.”
Let p = statement “ You get an A in the class”
Let q = statement “ I will give you five bucks.”
Now, if p is true (you got an A) and I give you the five bucks, the truth value of
p q is true. The contract was satisfied and both parties fulfilled the
agreement.
Now, suppose p is true (you got the A) and q is false (you did not get the five
bucks). You fulfilled your part of the bargain, but weren’t rewarded with the five
bucks.
So p q is false since the contract was broken by the other party.
Now, suppose p is false. You did not get an A but received five bucks anyway. (q
is true) No contract was broken. There was no obligation to receive 5 bucks, so
truth value of p q cannot be false, so it must be true.
Finally, if both p and q are false, the contract was not broken. You did not receive
the A and you did not receive the 5 bucks. So p q is true in this case.
12
11/14/2020
Examples
Let p = you receive 90%
Let q = you receive an A in the course
p q?
Converse: q p
If you receive an A in the course, then you receive 90%
Is the statement true? No. What about the student who
receives a score greater than 90? That student receives an A
but did not achieve a score of exactly 90%.
13
11/14/2020
Example 2
State the contrapositive in an English sentence:
Let p = you receive 90%
Let q = you receive an A in the course
p q?
If you receive 90%, then you will receive an A in the course
┐q ┐p
If you don’t receive an A in the course, then you didn’t
receive 90%.
The contrapositive is true not only for these particular
statements but for all statements , p and q.
14
11/14/2020
P Q P Q (P)
P)(Q)
T T F F F
T F F T T
F T T F T
F F T T T
15
11/14/2020
Exercises
To take discrete mathematics, you must have
taken calculus or a course in computer science.
When you buy a new car from Acme Motor
Company, you get $2000 back in cash or a 2%
car loan.
School is closed if more than 2 feet of snow falls
or if the wind chill is below -100.
Exercises
P QR
16
11/14/2020
Exercises
• When you buy a new car from Acme Motor
Company, you get $2000 back in cash or a 2%
car loan.
P: buy a car from Acme Motor Company
Q: get $2000 cash back
R: get a 2% car loan
P QR
Why use XOR here? – example of ambiguity of
natural languages
Exercises
• School is closed if more than 2 feet of snow
falls or if the wind chill is below -100.
P: School is closed
Q: 2 feet of snow falls
R: wind chill is below -100
Q RP
Precedence among operators:
, , , ,
17
11/14/2020
De Morgan’s Law
Equivalent Statements
P Q (PQ) (P)
P)(Q) (PQ)
Q)(P)
P)(Q)
T T F F T
T F T T T
F T T T T
F F T T T
The statements (PQ) and (P) (Q) are logically equivalent, since they
have the same truth table, or put it in another way, (PQ) (P) (Q)
is always true.
18
11/14/2020
De Morgan’s Law
Equivalent Statements
P Q (PQ) (P)
P)(Q) (PQ)
Q)(P)
P)(Q)
T T F F T
T F F F T
F T F F T
F F T T T
The statements (P Q) and (P) (Q) are logically equivalent, since they
have the same truth table, or put it in another way, (P Q) (P) (Q)
is always true.
19
11/14/2020
Equivalence
Definition: two propositional statements S1
and S2 are said to be (logically)
equivalent, denoted S1 S2 if
They have the same truth table, or
S1 S2 is a tautology
20
11/14/2020
Equivalence
Equivalence laws
Identity laws, P T P,
Domination laws, P F F,
Idempotent laws, P P P,
Double negation law, ( P) P
Commutative laws, P Q Q P,
Associative laws, P (Q R) (P Q) R,
Distributive laws, P (Q R) (P Q) (P R),
De Morgan’s laws, (PQ) ( P) ( Q)
Law with implication PQPQ
Exercises
Show that P Q P Q: by truth table
Show that (P Q) (P R) P (Q R): by
equivalence laws :
Law with implication on both sides
Distribution law on LHS
21
11/14/2020
22
11/14/2020
Propositional Functions
Let us consider the propositional function
Q(x, y, z) defined as:
x + y = z.
Here, Q is the predicate and x, y, and z 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
A propositional function (predicate) becomes a
proposition when all its variables are instantiated
instantiated..
Propositional Functions
Other examples of propositional functions
Person(x), which is true if x is a person
Person(Socrates) = T
Person(dolly--the
Person(dolly the--sheep) = F
CSCourse(x), which is true if x is a
computer science course
CSCourse(CSE173)
CSCourse (CSE173) = T
CSCourse(MATH155) = F
How do we say
All humans are mortal
Some CS course
Fall 2020 CSE 173 - Discrete Mathematics 46
23
11/14/2020
Universal Quantification
Universal Quantification
Example: Let the universe of discourse be all people
S(x): x is a NSU student.
G(x): x is a genius.
What does x (S(x) G(x)) mean ?
“If x is a NSU student, then x is a genius.” or
“All NSU students are geniuses.”
If the universe of discourse is all NSU students, then
the same statement can be written as
x G(x)
24
11/14/2020
Universal Quantification
Another example:
Let the universe of discourse be the real numbers.
Let Q(x) be the x.1 = x
What does x Q(x) mean ?
“For every x, x.1 = x”
Is it true? yes
Universal Quantification
Another example:
Let the universe of discourse be the real numbers.
Let P(x) be the x.0 = x
What does x P(x) mean ?
“For every x, x.0 = x”
Is it true? no
25
11/14/2020
Universal Quantification
Another example:
Let the universe of discourse be the integers’ set.
Let Q(x) be the x is an even integer
Let R(x) be the x2 is a multiple of 4
What does x [Q(x) R(x)] mean ?
“For every x, if x is an even integer then x2 is
multiple of 4 and if x2 is multiple of 4 then x is even”
Is it true? yes
Existential Quantification
Existentially quantified sentence:
There exists an x in the universe of discourse for
which P(x) is true.
26
11/14/2020
Existential Quantification
Example:
P(x): x is a NSU professor.
G(x): x is a genius.
Existential Quantification
Another example:
Let the universe of discourse be the real numbers.
Let Q(x) be the x.1 = x
What does x Q(x) mean ?
“There exists a value of x such that, x.1 = x”
Is it true? yes
27
11/14/2020
Existential Quantification
Another example:
Let the universe of discourse be the real numbers.
Let P(x) be the x.0 = x
What does x P(x) mean ?
“There exists a value of x such that x, x.0 = x”
Is it true? yes
Existential Quantification
Another example:
Let the universe of discourse be the real numbers.
Let P(x) be the x2 ≥ 0
Let Q(x) be the 3.x > 10
28
11/14/2020
Quantification
Another example:
Let the universe of discourse be the real numbers.
Is it true? yes
Quantification
Another example:
Let the universe of discourse be the real numbers.
Let P(x,y) be x > y
What does xy P(x, y) mean?
“We can find a value of x such that no matter what
the value of y, we have x >y”
Is it true? no
What does yx P(x, y) mean?
“For all y there is an x such that x > y”
Is it true? yes
Fall 2020 CSE 173 - Discrete Mathematics 58
29
11/14/2020
Disproof by Counterexample
Negation
30
11/14/2020
Negation
Let the universe of discourse be the integers.
Let Q(x) be the predicate x2 > 1
What does xQ(x) mean ?
“For every x, x2 > 1.”
Is it true? no
Negation
What does (x P(x)) means?
31
11/14/2020
Negation
Let the universe of discourse be the integers.
Let Q(x) be the predicate 2x is odd
What does xQ(x) mean ?
“For some value of x, 2x is odd”
Is it true? no
Negation Summary
(x P(x)) is logically equivalent to x (P(x)).
32
11/14/2020
Negation
More Examples
Not all roses are red
x (Rose(x) Red(x))
x (Rose(x) Red(x))
Nobody is perfect
x (Person(x) Perfect(x))
x (Person(x) Perfect(x))
Equivalency
Let universe of discourse be set of integers
E(X) be the predicate x is even
O(x) be the predicate x is odd
x[E(x) O(x)] is true
x[E(x)
xE(x)
xE (x) xxO(x) is also true
Thus x[P(x)
x[P(x) Q(x)] and xP
xP(x)
(x) x
xQ(x) are equivalent
But x[P(x)
x[P(x) Q(x)] and xP
xP(x)
(x) x
xQ(x) are not equivalent
Example:
x[E(x) O(x)] and xE
x[E(x) xE(x)
(x) xxO(x) are not equivalent
33
11/14/2020
Equivalency
Let universe of discourse be set of integers
Thus x[P(x)
x[P(x) Q(x)] and xP
xP(x)
(x) x
xQ(x) are not equivalent
But x[P(x)
x[P(x) Q(x)] and xP
xP(x)
(x) x
xQ(x) are equivalent
34
11/14/2020
Mathematical Reasoning
Valid Argument...
All Philosophers are immoral
Socrates is a philosopher
Conclusion: Therefore Socrates is immoral
35
11/14/2020
Mathematical Reasoning
We need mathematical reasoning to
determine whether a mathematical argument is
correct or incorrect and
construct mathematical arguments.
Terminology
An axiom is a basic assumption about mathematical
structure that needs no proof.
- Things known to be true (facts or proven theorems)
- Things believed to be true but cannot be proved
36
11/14/2020
Terminology
A theorem is a statement that can be shown to be
true.
Proofs
A theorem often has two parts
- Conditions (premises, hypotheses)
- conclusion
37
11/14/2020
Rules of Inference
Rules of inference provide the justification of the
steps used in a proof.
Rules of Inference
38
11/14/2020
Rules of Inference
p
_____ q
Addition
pq p q Modus
_____ tollens
p q p
_____
Simplification pq
p Hypothetical
p qr
_____ syllogism
q Conjunction
_____ p r (chaining
chaining))
p q
p q
p Disjunctive
p
pq Modus _____ syllogism
_____ ponens q (resolution
resolution))
q
Fall 2020 CSE 173 - Discrete Mathematics 77
Arguments
Just like a rule of inference, an argument consists of
one or more hypotheses (or premises) and a
conclusion.
We say that an argument is valid, if whenever all its
hypotheses are true, its conclusion is also true.
However, if any hypothesis is false, even a valid
argument can lead to an incorrect conclusion.
39
11/14/2020
Rules of Inference
Rules of inference provide the justification of the
steps used in a proof.
Arguments
Example:
“If John has a B in calculus, he will graduate. John
does have a B in calculus. Therefore he will
graduate.”
40
11/14/2020
Arguments
Which rule of inference was used in the last argument?
“If John has a B in calculus, he will graduate. John does
have a B in calculus. Therefore he will graduate.”
p: “John has a B in calculus.”
q: “he will graduate.”
pq
p Modus
_____ ponens
q
Arguments
Example:
“If 101 is divisible by 3, then 1012 is divisible by 9.
101 is divisible by 3. Consequently, 1012 is divisible
by 9.”
41
11/14/2020
Arguments
Which rule of inference was used in the last
argument?
Arguments
Example:
“If Harvey is a dentist, then Harvey drills teeth.
Hervey does not drill teeth. Therefore, Harvey is not
a dentist.”
42
11/14/2020
Arguments Example:
p: “Harvey is a dentist.”
“If Harvey is a
q: “Harvey drills teeth.” dentist, then Harvey
drills teeth. Hervey
pq does not drill teeth.
~q Therefore, Harvey is
_____
not a dentist.”
~p
From (i
(i)
Modus
~q ~p.
ponens
~q
_____
~p
Therefore, the conclusion p is correct.
Fall 2020 CSE 173 - Discrete Mathematics 85
Rules of Inference
p q
Disjunctive
p
_____ syllogism
q (resolution
resolution))
43
11/14/2020
Arguments
Example:
“Either elephant are blue or monkeys are green.
Elephants are grey (not blue).
Therefore, monkeys are green.”
Arguments
Example:
“Either elephant are
p: “Either elephants are blue.” blue or monkeys are
q: “Monkeys are green.” green. Elephants are
grey (not blue).
pq Therefore, monkeys
~p Disjunctive are green.”
_____ syllogism
q
44
11/14/2020
Rules of Inference
pq
Hypothetical
qr
_____ syllogism
p r (chaining
chaining))
Arguments
Another example:
“If it rains today, then we will not have a barbeque
today. If we do not have a barbeque today, then we
will have a barbeque tomorrow.
Therefore, if it rains today, then we will have a
barbeque tomorrow.”
45
11/14/2020
Arguments
Let us formalize the previous argument:
p: “It is raining today.”
q: “We will not have a barbecue today.”
r: “We will have a barbecue tomorrow.”
So the argument is of the following form:
Arguments
Another example:
i: “Gary is intelligent.”
a: “Gary is a good actor.”
c: “Gary can count from 1 to 10.”
46
11/14/2020
Arguments
Gary is either intelligent (i) or a good actor (a).
If Gary is intelligent (i), then he can count from 1 to 10 (c).
Gary can only count from 1 to 3 (~c).
Therefore, Gary is a good actor (a)..
Arguments
Yet another example:
47
11/14/2020
Arguments
A (B C)
C
BA
_________
__________
A
Step 1: A (B C) Hypothesis
Step 2: (B C) Simplification (from 1)
Step 3: C Disjunctive Syllogism
Step 4: B Disjunctive Syllogism (from 3 & 4)
Step 5: B A Hypothesis
Step 6: A Modus ponens
Arguments PQ
RP
RI
I
_________
__________
Q
Step 1: R I Hypothesis
Step 2: I Hypothesis
Step 3: R Disjunctive Syllogism
Step 4: R P Hypothesis
Step 5: P Modus ponens (from 3 & 4)
Step 6: P Q Hypothesis
Step 7: Q Modus ponens (from 5 & 6)
Fall 2020 CSE 173 - Discrete Mathematics 96
48
11/14/2020
Arguments (P Q) S
SR
(R Q)
_________
__________
P
Step 1: (R Q) Hypothesis
Step 2: R Q De Morgan’s Law
Step 3: R Simplification
Step 4: (P Q) S Hypothesis
Step 5: S R Hypothesis
Step 6: (P Q) R Disjunctive Syllogism
Step 7: (P Q) Modus ponens (from 3 & 6)
Step 8: P Q De Morgan’s Law
Step 9: P Simplification
Fall 2020 CSE 173 - Discrete Mathematics 97
x P(x) Existential
______________________
P(c) for some element c
cU instantiation
49
11/14/2020
Example:
x P(x) Universal
__________
P(c) if c
cU instantiation
50
11/14/2020
Proof methods
We will discuss six proof methods:
1. Direct proofs
2. Proof by cases
3. Indirect proofs
4. The Bi-conditional
5. Proof by contradiction
6. Counterexamples
101
51
11/14/2020
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 of math to show that q must also be
true (n2 is odd).
Proving Theorems
n is odd.
52
11/14/2020
Proving Theorems
Direct proof:
An implication p q can be proved by showing that if
p is true, then q is also true.
Proving Theorems
n is even.
Consequently, n2 = (2k)2.
= 4k2
= 2(2k2)
= 2m
53
11/14/2020
Proving Theorems
Direct proof:
An implication p q can be proved by showing that if
p is true, then q is also true.
Proving Theorems
54
11/14/2020
Proving Theorems
Direct proof:
An implication p q can be proved by showing that if
p is true, then q is also true.
Proving Theorems
55
11/14/2020
Proof methods
We will discuss six proof methods:
1. Direct proofs
2. Proof by cases
3. Indirect proofs
4. The Bi-conditional
5. Proof by contradiction
6. Counterexamples
111
Proving Theorems
Direct proof using cases:
Example: If q is not divisible by 3 then q2 mod 3 = 1
56
11/14/2020
Proving Theorems
Proving Theorems
q is not divisible by 3. Then either q mode 3 = 1 or q
mod 3 = 2 (for example 7 mod 3 = 1 and 8 mod 3 = 2)
57
11/14/2020
Proof methods
We will discuss six proof methods:
1. Direct proofs
2. Proof by cases
3. Indirect proofs
4. The Bi-conditional
5. Proof by contradiction
6. Counterexamples
115
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).
58
11/14/2020
Proving Theorems
n is even.
Therefore, 3n + 2 is even.
Which to use
When do you use a direct proof versus
an indirect proof?
118
59
11/14/2020
119
120
60
11/14/2020
Proof methods
We will discuss six proof methods:
1. Direct proofs
2. Proof by cases
3. Indirect proofs
4. The Bi-conditional
5. Proof by contradiction
6. Counterexamples
121
Proving Theorems
The Bi-conditional proof:
If a theorem is of the form p q is equivalent to p
q and q p. You have to prove both
Example: Give a proof of the theorem
“An integer x is even if and only if x2 is even.”
Idea: Prove two things:-- (1) If x is even then x2 is
even , and (2) if x2 is even then x is even. We have
already proved both in previous slides.
61
11/14/2020
Proof methods
We will discuss six proof methods:
1. Direct proofs
2. Proof by cases
3. Indirect proofs
4. The Bi-conditional
5. Proof by contradiction
6. Counterexamples
123
Proof by contradiction
Given a statement p, assume it is false
Assume ¬p
124
62
11/14/2020
63
11/14/2020
Proof methods
We will discuss six proof methods:
1. Direct proofs
2. Proof by cases
3. Indirect proofs
4. The Bi-conditional
5. Proof by contradiction
6. Counterexamples
128
64
11/14/2020
129
65
11/14/2020
66
11/14/2020
67