DS Chapter 01
DS Chapter 01
DS Chapter 01
Chapter 1
The Foundations: Logic and Proofs
“y > 5”
Is this a statement? no
It’s a request.
Is this a proposition? no
1 + 2 = 3. (T)
A fact-based declaration is a proposition,
even if no one knows whether it is true
11213 is prime.
p q pq
T T T
T F F
F T F
F F F
Note that a conjunction p1 p2 … pn of n
propositions will have 2n rows in its truth table
01/31/24 Discrete Mathematics Chapter 1 21
The Disjunction Operator
The binary disjunction operator “” (OR)
combines two propositions to form their
logical disjunction.
F T
Note that pq meansTthat p is true, or q is
true, or both F
are F
true! F
So, this operation is also called inclusive or,
because it includes the possibility that both
p and q are true.
01/31/24 Discrete Mathematics Chapter 1 23
The Exclusive-Or Operator
p q pq
T T T
The only
T F F False case!
F T T
F F T
p q is false only when p is true but q is not true.
p q does not require that p or q are ever true!
E.g. “(1=0) pigs can fly” is TRUE!
01/31/24 Discrete Mathematics Chapter 1 28
Statements and Operators
Statements and operators can be combined in any way to
form new statements.
P Q P Q (P)(Q)
T T F F F
T F F T T
F T T F T
F F T T T
PQR
Problem with proposition R
– What if I want to represent “take CS201”?
PQR
Why use XOR here? – example of ambiguity of natural
languages
– P: School is closed
– Q: 2 feet of snow falls
– R: wind chill is below -100
QRP
Precedence among operators:
, , , ,
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.
Is it true? yes
p˄q pq
_____ qr Hypothetical
p Simplification _____ syllogism
pr (chaining)
p
q pq
_____ Conjunction ¬p Disjunctive
p˄q _____ syllogism
q (resolution)
p
pq Modus ponens
_____
q
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.”
pq
qr Hypothetical
______
syllogism
Pr
i: “Gary is intelligent.”
a: “Gary is a good actor.”
c: “Gary can count from 1 to 10.”
Step 1: c Hypothesis
Step 2: i c Hypothesis
Step 3: i Modus tollens Steps 1 & 2
Step 4: aI Hypothesis
Step 5: a Disjunctive Syllogism
Steps 3 & 4
x P(x)
______________________ Existential
P(c) for some element c U instantiation
Example:
U(x): “x is a PU student.”
G(x): “x is a genius.”
x P(x)
__________ Universal
P(c) if c U instantiation
n is odd.
Therefore, 3n + 2 is even.