0% found this document useful (0 votes)
26 views176 pages

2215 CH 1

Uploaded by

supernguyen69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views176 pages

2215 CH 1

Uploaded by

supernguyen69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 176

MTH-2215

Applied Discrete Mathematics

Chapter 1, Section 1.1


Propositional Logic

These class notes are based on material from our


textbook, Discrete Mathematics and Its
Applications, 6th ed., by Kenneth H. Rosen,
published by McGraw Hill, Boston, MA, 2006. They
are intended for classroom use only and are not a
substitute for reading the textbook.
Proposition
• A proposition is a declarative sentence that is
either true or false, but not both.
• Other way: A proposition is a statement that is
true or false.
• Examples:
– The capital of New York is Albany.
– The moon is made of green cheese.
– Go to town. (not a proposition – why?)
– What time is it? (not a proposition – why?)
– x + 1 = 2 (not a proposition – why?)
Simple/Compound Propositions

• A simple proposition has a value of T/F


• A compound proposition is constructed from
one or more simple propositions using logical
operators
• The truth value of a compound proposition
depends on the truth values of the constituent
propositions
Negation (NOT)
• NOT can be represented by the ~ or 
symbols
• NOT is a logical operator:
p: I am going to town.
~p: I am not going to town.
Truth table for ~ (NOT)

p ~p

T F

F T
Truth Tables
• A truth table lists ALL possible values of a
(compound) proposition
– one column for each propositional variable
– one column for the compound proposition
– 2n rows for n propositional variables
Conjunction (AND)
• The conjunction AND is a logical operator

p: I am going to town.
q: It is raining.
p  q: I am going to town and it is raining.

• Both p and q must be true for the conjunction


to be true.
Truth table for ^ (AND)
p q p^q
T T T

T F F

F T F

F F F
Disjunction (OR)
• Inclusive or - only one proposition needs to be
true for the disjunction to be true.
p: I am going to town.
q: It is raining.
p  q: I am going to town or it is raining.
Truth table for  (OR)
p q pq
T T T

T F T

F T T

F F F
Exclusive OR
• Only one of p and q are true (not both).
p: I am going to town.
q: It is raining.
p  q: Either I am going to town or it is raining.
Truth table for  (Exclusive OR)

p q pq
T T F

T F T

F T T

F F F
Conditional statements
• A conditional statement is also called an
implication or an if .. then statement.
• It has the form p  q
p: I am going to town.
q: It is raining.
p  q: If I am going to town, then it is raining.
• The implication is false only when p is true and
q is false!
Truth table for Conditional statements

p q pq
T T T

T F F

F T T

F F T
Implication - Equivalent Forms
• If p, then q
• p implies q
• If p, q
• q if p
• q whenever p
• p is a sufficient condition for q
• q is a necessary condition for p
• p only if q
Converse of an Implication

• Implication: p  q
• Converse: qp
• Implication:
– If I am going to town, it is raining.
• Converse:
– If it is raining, then I am going to town.
Converse of an Implication
p q qp
T T T

T F T (for p  q, this would be F)

F T F (for p  q, this would be T)

F F T
Contrapositive of an Implication
• Implication: pq
• Contrapositive: q  p
• Implication:
– If I am going to town, it is raining.
• Contrapositive:
– If it is not raining, then I am not going to town.
• The contrapositive has the same truth table as
the original implication.
Inverse of an Implication
• Implication: p  q
• Inverse: p  q
• Implication:
– If I am going to town, it is raining.
• Inverse:
– If I am not going to town, then it is not raining.
• The inverse of an implication has the same
truth table as the converse of that implication.
Biconditional
• “if and only if”, “iff”
• pq
• I am going to town if and only if it is raining.
• Both p and q must have the same truth value
for the assertion to be true.
Truth Table for  (Biconditional)
p q pq
T T T

T F F

F T F

F F T
Truth Table Summary of Connectives

p q p  q p  q pq pq pq


T T T T F T T
T F F T T F F
F T F T T T F
F F F F F T T
Compound Propositions
• To construct complex truth tables, add
intermediate columns for smaller (compound)
propositions
• One column for each propositional variable
• One column for each compound proposition
• For n propositional variables there will be 2 n
rows
• Example:
(p  q)  r
Truth Tables for Compound Propositions

p q r pq ~r (p  q)  ~r
T T T T F F
T T F T T T
T F T T F F
T F F T T T
F T T T F F
F T F T T T
F F T F F T
F F F F T T
Precedence of Logical Operators
• Parentheses gets the highest precedence
• Then:
Operator Precedence
 1
 2
 3
 4
 5
Precedence of Logical Operators
• Examples:
p  q  r means (p  q)  r, not p  (q  r)
p  q  r means (p  q)  r
Translating English Sentences
• To remove natural language ambiguity
• Helps in reasoning
• Examples:
– You can access the Internet from campus
only if you are a computer science major or
you are not a freshman.
– You cannot ride the roller coaster if you are
under 4 feet tall unless you are older than 16
years old.
Logic and Bit Operations
• Binary numbers use bits, or binary digits.
• Each bit can have one of two values:
1 (which represents TRUE)
0 (which represents FALSE)
• A variable whose value can be true or false is
called a Boolean variable. A Boolean variable’s
value can be represented using a single bit.
Logic and Bit Operations
• Computer bit operations are exactly the same as the logic
operations we have just studied. Here is the truth table
for the bit operations OR, AND, and XOR:

x y xy xy xy


0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 0
MTH 2215
Applied discrete mathematics

Chapter 1, Section 1.2


Propositional Equivalences
Basic Terminology

• A tautology is a proposition which is always


true. Example:
p  p
• A contradiction is a proposition that is always
false. Example:
p  p
Basic Terminology

p p p  p p  p
T F T F

F T T F
Basic Terminology

• A contingency is a proposition that is neither a


tautology nor a contradiction. Example:
p  q  r
Logical Equivalences
• Two propositions p and q are logically
equivalent if they have the same truth values
in all possible cases.
• Two propositions p and q are logically
equivalent if p  q is a tautology.
• Notation: p  q or p  q
Determining Logical Equivalence
• Consider the following two propositions:
(p  q)
p  q
• Are they equivalent? Yes. (They are part of
DeMorgan’s Law, which we will see later.)
• To show that (p  q) and p  q are
logically equivalent, you can use a truth table:
Equivalence of (p  q) and p  q

p q p  q (p  q) p q p  q
T T T F F F F

T F T F F T F

F T T F T F F

F F F T T T T
Show that: p  q  p  q

p q p p  q pq
T T F T T

T F F F F

F T T T T

F F T T T
Determining Logical Equivalence

• This is not a very efficient method. Why?


• To be more efficient, we develop a series of
equivalences, and use them to prove other
equivalences.
Important Equivalences

pTp Identity
pFp

pTT Domination
pFF
ppp Idempotent
ppp

( p)  p Double Negation


Important Equivalences
pqqp Commutative
pqqp

(p  q)  r  p  (q  r) Associative
(p  q)  r  p  (q  r)

p  (q  r)  (p  q)  (p  r) Distributive
p  (q  r)  (p  q)  (p  r)
(p  q)  p  q De Morgan’s
(p  q)  p  q
Important Equivalences

p  (p  q)  p Absorption
p  (p  q)  p

p  p  T Negation
p  p  F
Example
Show that (p  q) and p  q are logically
equivalent:

(p  q)  (p  q) Example 3


 (p)  q 2nd DeMorgan law
 p  q double negation
law
Q.E.D
Example
Show that (p  q) and p  q are logically equivalent:

(p  q) (p  q) Example 3

(p)  q 2nd DeMorgan law

p  q double negation law

Q.E.D
Example
Show that (p  (p  q)) and p  q are logically equivalent:

(p  (p  q)) p  (p  q) 2nd DeMorgan

p  [(p)  q)] 1st DeMorgan

p  (p  q) double negation

(p  p)  ( p  q) 2nd distributive

FALSE  ( p  q) negation

( p  q)  FALSE commutative

p  q identity
Equivalences Involving Implications

p→q  p  q
p→q  q → p
pq  p → q
pq  (p → q)
(p → q)  p  q
More Equivalences Involving
Implications

(p → q)  (p → r)  p → (q  r)
(p → r)  (q → r)  (p  q) → r

(p → q)  (p → r)  p → (q  r)
(p → r)  (q → r)  (p  q) → r
Equivalences Involving Biconditionals

p↔q  (p → q)  (q → p)
p↔q  p ↔ q
p↔q  (p  q)  (p  q)
(p ↔ q )  p ↔ q
Example
•Show that (p  q)  (p  q) is a tautology.
(p  q)  (p  q) (p  q)  (p  q) p → q  p  q

(p  q)  (p  q) 1st DeMorgan law

p  (q  (p  q)) Associative law

p  ((p  q)  q) Commutative law

(p  p)  (q  q) Associative law

TRUE  TRUE Negation

TRUE Domination law


MTH 2215
Applied discrete mathematics

Chapter 1, Section 1.3


Predicates and Quantifiers
Predicates
• A predicate is a statement that contains
variables.
• Examples:
P(x) : x > 3
Q(x,y) : x = y + 3
R(x,y,z) : x + y = z

• The area of logic that deals with predicates and


quantifiers is called predicate calculus.
Predicates
• A predicate becomes a proposition if the
variables contained in it are either:
– Assigned specific values
– Quantified (all, many, some, few, none)

P(x) : x > 3
What are the truth values of P(4) and P(2)?

Q(x,y) : x = y + 3
What are the truth values of Q(1, 2) and Q(3, 0)?
Quantifiers

• Two types of quantifiers


– Universal quantifier: 
– Existential quantifier: 

• Universe of discourse - the particular


domain of the variable in a propositional
function
Universal Quantification

• P(x) is true for all values of x in the universe of


discourse.

x P(x)
“for all x, P(x)”
“for every x, P(x)”

• The variable x is bound by the universal


quantifier, producing a proposition.
Examples

• U = {all real numbers}, P(x): x+1 > x


– What is the truth value of x P(x)

• U = {all real numbers}, Q(x): x < 2


– What is the truth value of x Q(x)

• U = {all students in MTH 2215}


R(x) : x has an account on Banner
– What does x R(x) mean?
For universal quantification
P(x)  P(x1)  P(x2)  …  P(xn)

• If the elements in the universe of discourse can be listed,


then U = {x1, x2, …, xn}
x P(x)  P(x1)  P(x2)  …  P(xn)

• Example
U = {positive integers not exceeding 3} and P(x): x2 < 10
– What is the truth value of x P(x)?
P(1)  P(2)  P (3)
T  T  T
T
Existential Quantification
• P(x) is true for some x in the universe of
discourse

x P(x)
“for some x, P(x)”
“There exists an x such that P(x)”
“There is at least one x such that P(x)”

• The variable x is bound by the existential


quantifier, producing a proposition
Example
• U = {all real numbers}, P(x): x > 3
– What is the truth value of x P(x)

• U = {all real numbers}, Q(x): x = x + 1


– What is the truth value of x Q(x)

• U = {all students in MTH 2215},


R(x) : x has an account on Banner
– What does x R(x) mean?
For existential quantification
x P(x)  P(x1)  P(x2)  …  P(xn)

• If the elements in the universe of discourse can be listed,


U = {x1, x2, …, xn}
x P(x)  P(x1)  P(x2)  …  P(xn)

• Example
U = {positive integers not exceeding 4} and P(x): x2 < 10
– What is the truth value of x P(x)?
P(1)  P(2)  P(3)  P(4)
T  T  T  F
T
Binding Variables
• Bound variable: if a variable is quantified
• Free variable: Neither bound nor assigned a
specific value
– Example: x P(x), x Q(x,y)
• Scope of Quantifiers: Part of a logical
expression to which a quantifier is applied
– Example: x (P(x)  Q(x))  x R(x)
Negation of Quantifiers
• Distributing a negation operator across a
quantifier changes a universal to an existential
and vice versa.
~x P(x)  x ~P(x)
~ x P(x)  x ~P(x)
Negation of Quantifiers
• Example:
Assume the domain of x is: {students in MTH 2215},
and P(x) : x has taken a course in calculus. Then
x P(x)
means “All students in MTH 2215 have taken a course
in calculus.”
The negation of this statement would be, “Not every
student in MTH 2215 has taken a course in calculus,” or
“There exists some student in MTH 2215 who has not
taken a course in calculus.” This would be:
x P(x)
Translating from English
• There are many ways to translate a given
sentence
• The goal is to produce a logical expression that is
simple and can be easily used in subsequent
reasoning
• Steps:
– Clearly identify the appropriate quantifier(s)
– Introduce variable(s) and predicate(s)
– Translate using quantifiers, predicates, and logical
operators
Example
“Every student in this class has studied calculus.”
• Solution 1
– Assume, U = {all students in MTH 2215}
– Rewrite the sentence: “For every student in the class,
that student has studied calculus.”
– Introduce a variable, x: “For every student x in the
class, x has studied calculus.”
– Replace “x has studied calculus” with: C(x)
– Since our domain is all students in MTH 2215, we
can now represent our sentence with: x C(x)
Example
• “Every student in this class has studied calculus.”
• Solution 2
– Assume, U = {all people}
– Rewrite the sentence: “For every person x, if x is a
student in the class, then x has studied calculus.”
– Replace “x is a student in the class” with: S(x)
– Replace “x has studied calculus” with: C(x)
– We can now represent our sentence with:
x S(x)  C(x)
Example

• Some student in this class has visited Mexico


• Solution 1
– Assume, U = {all students in MTH 2215}
 x M(x)
• Solution 2
– Assume, U = {all people}
 x S(x)  M(x)
More Examples
• C(x): x is a CSE student
• E(x): x is an ECE student
• S(x): x is a smart student
• U = {all students in MTH 2215}
More Examples (Cont..)
• Everyone is a CSE student.
x C(x)
• Nobody is an ECE student.
x ~E(x) or ~x E(x)
• All CSE students are smart students.
x [C(x)  S(x)]
• Some CSE students are smart students.
x [C(x)  S(x)]
Use implication or conjunction?

• Universal quantifiers usually take implications


• All CSE students are smart students.
x [C(x)  S(x)] Correct
x [C(x)  S(x)] Incorrect
Use implication or conjunction?
• Existential quantifiers usually take conjunctions
• Some CSE students are smart students.
x [C(x)  S(x)] Correct
x [C(x)  S(x)] Incorrect
More Examples
• No CSE student is an ECE student.
– If x is a CSE student, then that student is not an ECE
student.
x [C(x)  ~E(x)]
– There does not exist a CSE student who is also an
ECE student.
~x [C(x)  E(x)]
• If any ECE student is a smart student then he is
also a CSE student.
x [(E(x)  S(x))  C(x)]
MTH 2215

Chapter 1, Section 1.4


Nested Quantifiers
Nested Quantifiers

• Quantifiers that occur within the scope of


other quantifiers
• Example:
P(x,y): x + y = 0, U={R}
x y P(x,y)
Quantifications of Two Variables
• For all pairs x,y P(x,y).
xy P(x,y) yx P(x,y)
• For every x there is a y such that P(x,y).
xy P(x,y)
• There is an x such that P(x,y) for all y.
xy P(x,y)
• There is a pair x,y such that P(x,y).
xy P(x,y) yx P(x,y)
Translating statements with nested quantifiers

U = {all real numbers}


x y (x + y = y + x)

Expressed in English:
“For all real numbers x, for all real numbers y,
x + y = y + x”

This statement is true.


Now let’s reverse the x and y ….
Translating statements with nested quantifiers

U = {all real numbers}


y x(x + y = y + x)
Expressed in English:
“For all real numbers y, for all real numbers x,
x + y = y + x”

This statement is also true.


Reversing the quantifiers does not make any
difference, because both are of the same type.
Translating statements with nested quantifiers

U = {all real numbers}


Express in English:
x y (x + y = 0)
“For every real number x there exists some real
number y such that (x + y = 0).”
This is claiming that, given a real number x there
is a real number y such that x + y = 0. It is easy
to see that y must be –x. So this statement is
true.
But check the next slide….
Translating statements with nested quantifiers

U = {all real numbers}


Express in English:
y x (x + y = 0)
“There exists some real number y such that for
every real number x, (x + y = 0).”
This is claiming that there is some specific y to
which we can add any real number x and have
x + y = 0.
Obviously, there is no real number y for which it
is true that x + y = 0 for all values of x. So this
statement is false.
Translating statements with nested quantifiers

When we changed
x y (x + y = 0)
to
y x (x + y = 0)
we changed the meaning of the statement, and
ended up with a false one.
Obviously, if the quantifiers are of different types,
then order is important.
Translating statements with nested quantifiers

U = {all real numbers}


Express in English:
x y ( (x > 0)  (y < 0)  (xy < 0) )

“For all x, for all y, if x is greater than zero


and y is less than zero, then multiplying
them together will produce a negative
number.”
This is a true stement.
Translating statements with nested quantifiers

U = {all students in MTH 2215}


Express in English:
C(x): x has a computer
F(x,y): x and y are friends
x ( C(x)  y (C(y)  F(x,y)) )

“For every student x in MTH 2215, x has a computer


or there exists some student y such that y has a
computer and x and y are friends.”
Translating Sentences
• U = {all people}
“If a person is female and is a parent, then
this person is someone’s mother.”
Translate this into a logical expression:
x ((F(x)  P(x))  y M(x,y))
Can we move the existential quantification over
to the left side? Yes (see the null
quantification rule in exercise 47 on p. 49):
x y ((F(x)  P(x))  M(x,y))
Translating Sentences
U = {all integers}
“The sum of two positive integers is positive.”
Translate this into a logical expression:
xy ((x > 0)  (y > 0)  ((x + y) > 0)

BUT if we change the domain so that


U = {all positive integers}
then
xy ((x + y) > 0)
Is the order of quantifiers important?
• If the quantifiers are of the same type,
then order does not matter.
• If the quantifiers are of different types,
then order is important.
Example
U={R}
Q(x, y): x + y = 0
What are the truth values for y x Q(x,y) and x y
Q(x,y) ?
y x Q(x,y): There exists at least one y such that for
every real number x, Q(x,y) is true, i.e., x + y = 0.
FALSE (not for every x, only when y is –x).
But…
x y Q(x,y): For every real number x, there is a real
number y such that Q(x,y) is true, i.e., x + y = 0.
TRUE (for every x when y is –x)
Negating Nested Quantifiers
• To negate nested quatifiers, apply De Morgan’s
Laws for Quantifiers successively for each
quantifier.
• Example:
“There does not exist a woman who has taken a
flight on every airline in the world.”

First express the positive of this statement:


“There is a woman who has taken a flight on
every airline in the world.”
Negating Nested Quantifiers
“There is a woman who has taken a flight
on every airline in the world.”
P(w, f) = “woman w has taken flight f”
Q(f, a) = “flight f is a flight on airline a”
w a f (P(w, f)  Q(f, a))

“There exists some woman w such that, for


all airlines a, there exists some flight f
such that w has taken this flight.”
Negating Nested Quantifiers
Now we negate the previous logical expression to
get:
w a f (P(w, f)  Q(f, a))
Successively applying DeMorgan’s laws we get:
w a f (P(w, f)  Q(f, a))
w a  f (P(w, f)  Q(f, a))
w a f (P(w, f)  Q(f, a))
w a f (P(w, f)  Q(f, a))
Negating Nested Quantifiers
w a f (P(w, f)  Q(f, a))
can be read as”
“For every woman there exists some
airline such that for all flights either
this woman has not taken that flight or
that flight is not on this airline.”
MTH 2215

Chapter 1, Section 1.5


Rules of Inference
Rules of Inference

argument
H1
H2 H1, H2, … Hn the hypotheses (premises)
We use conjunction: H1 ^ H2 ^ H3…

Hn

C is the conclusion.
C
“” means “therefore” or “it follows that”
Validity of an Argument
• An argument is valid if
– whenever all hypotheses are true, the conclusion is
also true
• To prove that an argument is valid:
– Assume the hypotheses are true
– Use the rules of inference and logical equivalences
to determine that the conclusion is true
Some Rules of Inference
p
pq [p  (p  q)]  q Modus ponens
------------------- mode that affirms
q
q
pq [ q  (p  q)]   p Modus tollens
------------------- mode that denies
p
pq
qr [(p  q)  (q  r)]  (p  r) Hypothetical
------------------- syllogism
pr
pq
p [(p  q)  p]  q Disjunctive
------------------- syllogism
q
Some Rules of Inference
p
------------------- ppq Addition
pq
pq
------------------- pqp Simplification
p
p
q [(p)  (q)]  (p  q) Conjunction
-------------------
pq
pq
p  r [(p  q)  (p  r)]  (q  r) Resolution
-------------------
qr
Example: Modus Ponens
from Latin: mode that affirms

p ( p  ( p  q ))  q Modus Ponens
pq
q

• In other words:
If the hypothesis p is true
and the hypothesis (p  q) is true
Then I can conclude q
Example: Modus Ponens

• p: “n is greater than 3”
• q: “n2 is greater than 9”

• Assuming that p q is true, then:


if is n greater than 3, it follows that n 2 is
greater than 9.
Example: Hypothetical syllogism

pq
qr Hypothetical syllogism
pr
____________________________________________

• If it rains today, then we will not have a barbecue


today.
• If we do not have a barbecue today, then we will have
a barbecue tomorrow
• Therefore, if it rains today, then we will have a
barbecue tomorrow.
Example: Simplification

pq ( p  q)  p Simplification
p

p: “it is below freezing”


q: “it is raining now”

• It is below freezing and raining now.


Therefore, it is below freezing.
Recap 1.2: Important Equivalences

pTp Identity
pFp
pTT Domination
pFF
ppp Idempotent
ppp
( p)  p Double Negation
Recap 1.2: Important Equivalences

pqqp Commutative
pqqp
(p  q)  r  p  (q  r) Associative
(p  q)  r  p  (q  r)
p  (q  r)  (p  q)  (p  r) Distributive
p  (q  r)  (p  q)  (p  r)
(p  q)  p  q De Morgan’s
(p  q)  p  q
Recap 1.2: Important Equivalences

p  (p  q)  p Absorption
p  (p  q)  p
p  p  T Negation
p  p  F
Example

• Consider the following logical argument:


– If horses fly or cows eat artichokes, then the
mosquito is the national bird.
– If the mosquito is the national bird then
peanut butter tastes good on hot dogs.
– But peanut butter tastes terrible on hot dogs.
– Therefore, cows don’t eat artichokes.
Example
• Assignments:
p Horses fly
q Cows eat artichokes
r The mosquito is the national bird
s Peanut butter tastes good on hot dogs

• Represent the argument using the variables


(p  q)  r
rs Hypotheses
s
 q Conclusion
Example
Assertion Reasons
1. (p  q)  r Hypothesis
2. r  s Hypothesis
3. (p  q)  s Hypothetical syll. on 1. and 2.
4. s Hypothesis
5. (p  q) Modus tollens on 3. and 4.
6. p  q DeMorgan on 5.
7. q  p Commutative on 6.
8. q Simplification on 7.
We have obtained our conclusion: “cows don’t eat artichokes”
Example
• Show that the following argument is valid:
– It is not sunny this afternoon and it is colder than
yesterday.
– We will go swimming only if it is sunny.
– If we do not go swimming, then we will take a canoe
trip.
– If we take a canoe trip, then we will be home by
sunset.
– Therefore, we will be home by sunset.
Example: Put into propositional form

p = it is sunny this afternoon


q = it is colder than yesterday
r = we will go swimming
s = we will take a canoe trip
t = we will be home by sunset
Example: Represent hypotheses
p  q It is not sunny this afternoon and it is colder
than yesterday
rp We will go swimming only if it is sunny

r  s If we do not go swimming, then we will take


a canoe trip
st If we take a canoe trip, then we will be home
by sunset
t We will be home by sunset
Example: Constuct logical argument

p  q Hypothesis
p Simplification using previous step
r  p Hypothesis
r Modus tollens using steps 2 and 3
r  s Hypothesis
s Modus ponens using steps 4 and 5
s  t Hypothesis
t Modus ponens using steps 6 and 7
Rules of Inference for Quantified Statements

xP(x), then for any


C, therefore P(c) is true

xP(x)
therefore for at
least one specific c,
P(c) is true
Rules of Inference for Quantified Statements
In Universal Instantiation, we know that P(x) is true for all
values of x; therefore it must also be true of any
particular value of x, c.
In Universal Generalization, we know that P(c) is true for
any specific value of c; therefore it must be true for all
values, so x P(x).
In Existential Instantiation, we know that P(x) is true for at
least one specific value of x, c.
• In Universal Instantiation, we know that P(c) is true for
some particular value of c, so x P(x). Here c need not be
arbitrary but often is assumed to be.
Example
Show that the following argument is valid:
• Everyone in the Applied discrete
mathematics class has taken a CSE course.
• Marla is a student in the Applied discrete
mathematics class.
• Therefore, Marla has taken a CSE course.
Example:
Put into propositional form:
D(x) = x is in the Applied discrete mathematics class
C(x) = x has taken a CSE course
Represent hypotheses:

x(D(x)  C(x)) Everyone in the Applied discrete


mathematics class has taken a
CS course
D(Marla) Marla is a student in the Applied
discrete mathematics class
Example: Constuct logical argument

STEP JUSTIFICATION
x(D(x)  C(x)) Premise

D(Marla)  C(Marla) Universal Instantiation using


step 1
D(Marla) Premise

C(Marla) Modus ponens using steps 2


and 3
Do as Exercise
• A student in this class has not read the book.
• Everyone in this class passed the first exam.
• Therefore, someone who passed the first exam
has not read the book.
Fallacies
• Fallacies resemble rules of inference but
are based on contingencies rather than
tautologies. They are incorrect inferences.
• Three common fallacies
– Affirming the Consequent
– Denying the Hypothesis
– Circular Reasoning (begging the question)
Fallacy of Affirming the Consequent

pq (( p  q )  q )  p
q
p

• This argument is fallacious. ((p  q)  q)  p


is not a tautology and therefore not a rule of
inference.
Example
If you do every problem in this book, then you will
learn Applied discrete mathematics.
You learned Applied discrete mathematics.
Therefore, you did every problem in this book.

• This is the “Fallacy of Affirming the


Consequent”. You might have learned discrete
mathematics by paying attention in class
instead of by doing all the problems.
Fallacy of Denying the Hypothesis

pq (( p  q )   p )   q
p
 q

This argument is fallacious.


((p  q)  p)  q is not a tautology and
therefore not a rule of inference.
Example
If you do every problem in this book, then you will
learn Applied discrete mathematics.
You did not do every problem in this book.
Therefore, you did not learn Applied discrete
mathematics.
This is the “Fallacy of Denying the Hypothesis”.
Even though you did not do every problem in
this book, you still might have learned Applied
discrete mathematics by paying attention in
class.
MTH 2215
Applied discrete mathematics

Chapter 1, Section 1.6


Introduction to Proofs
Definitions

• A theorem is a valid logical assertion which can


be proved using
– Axioms: statements which are given to be true
– Rules of inference: logical rules allowing the
deduction of conclusions from premises
• A lemma is a ‘pre-theorem’ or a result which is
needed to prove a theorem.
• A corollary is a ‘post-theorem’ or a result which
follows directly from a theorem.
Methods of Proof
• Direct proof
• Indirect proof
• Vacuous proof
• Trivial proof
• Proof by contradiction
• Proof by cases
• Existence proof
Proof Basics

• We want to establish the truth p q p q


of p  q
T T T
T F F
• p may be a conjunction of
other hypotheses F T T
F F T
• p  q is a conjecture until a
proof is produced
Direct Proof
• Assume the hypotheses are true
• Use rules of inference and any logical
equivalences to establish the truth of the
conclusion
• HOW TO PROVE:
– If p is true, then q has to be true for p  q to be true
• Example: The proof we did earlier about cows
not eating artichokes was an example of a direct
proof
Example
• Give a direct proof of the theorem: “If n is an
odd integer, then n2 is an odd integer”
(n is odd)  (n2 is odd)
• Using the following definition:
– If n is even, then there exists an integer k
such that n=2k, and if it is odd, if there exists
an integer k such that n=2k+1.
Example (Cont.)
Assume the hypothesis “n is odd” true:
n is odd
Since n is odd, then k n = 2k + 1
Now, is the conclusion “n2 is odd” true?
n2 = (2k + 1)2 = 4k2 + 4k + 1
= 2(2k2 + 2k) + 1
= 2(m) +1, where some
integer m=
2k2 + 2k
Since n2 = 2(m)+1, then “n2 is odd” is true
Proof complete
Indirect Proof
• Proofs that are not direct proofs – that is,
do start with the hypothesis and end with
the conclusion – are called indirect proofs.
Indirect Proof
• One useful type of indirect proof is proof
by contraposition
• Remember that p  q is equivalent to ~q
 ~p (its contrapositive)
• Therefore, we can prove p  q indirectly
by showing that its contrapositive, ~q 
~p, is true.
Example
Give an indirect proof to the theorem:
“if 3n + 2 is odd, then n is odd”
(3n + 2 is odd)  (n is odd)

p 3n + 2 is odd ~p 3n + 2 is even
q n is odd ~q n is even

The contrapositive is:


~(n is odd)  ~ (3n + 2 is odd)
or, in other words,
(n is even)  (3n + 2 is even)
Example (Cont.)
n is even Assuming the hypothesis (of the
contrapositive)
n = 2k Def. of “even”

3n + 2 = 3(2k) + 2 = 6k + 2 Replacing n with 2k and


simplifying
3n + 2 = 2(3k + 1) Factoring

3n + 2 = 2(m) Replacing 3k + 1 with m


3n + 2 is even Def. of “even”

Proof complete!
Example (Cont)

Since we now know that:


“~(n is odd)  ~ (3n + 2 is odd)”
is true, we also know that its contrapositive
(our original statement):
“(3n + 2 is odd)  (n is odd)”
must be true.
Vacuous Proof
• If we know one of the hypotheses in p is false then
p  q is vacuously true.
• F  T and F  F are both true.
• Example:
– If I am both rich and poor, then hurricane Katrina was a mild
breeze.
• The hypotheses (p  p) form a contradiction, and
therefore q follows from the hypotheses vacuously.
• If we start out assuming that a false premise is true,
then we can prove almost anything we want!
Example
Given the proposition P(n): if n > 1, then n2 > n,
show that P(0).

P(n): (n > 1)  (n2 > n)


P(0): (0 > 1)  (02 > 0)

A conditional statement with a false hypothesis is


guaranteed to be true. Since the hypothesis (0 >1) is
false, P(0) is automatically true.
Trivial Proof
• If we know q is true, then p  q is true
• F  T and T  T are both true.
• Example:
– If it’s snowing today then the empty set is a subset
of every set.
• The assertion is trivially true independent of the
truth value of p.
Example
Given the proposition
P(n): if a  b > 0, then an  bn
show that P(0) is true.

P(n): (a  b > 0)  (an  bn)


P(0): (a  b > 0)  (a0  b0), in other words
P(0): (a  b > 0)  (1  1),

Since the conclusion (1  1) is true, P(0) is true.


Proof by Contradiction
• Sometimes called “Reductio ad absurdum”
(reduction to the absurd )
• We want to prove p. We do that by assuming the
opposite, p, and show that that implies a
contradiction q (i.e., q is FALSE no matter what,
or is absurd).
• Mathematical definition of the proof
– Find a contradiction q such that
p  q  p  F  (p)  p
Proof by Contradiction
Suppose that we want to prove that 2 is irrational.
Proof:
1. By definition, if a real number x is
rational then there exist two
integers m and n such that x = m/n.
2. Assume that 2 is rational.
3. Then there are integers m’ and n’
such that 2 = m’/n’.
4. We divide m’ and n’ by all factors
common to both m’ and n’, giving us
two integers, m and n, with no common
factors, and 2 = m/n.
Proof by Contradiction
5. Since m/n = 2, m = n2
6. Squaring both sides of the equation
gives us: m2 = n22
7. Therefore, m2 must be even, and
consequently m must be even.
8. Since m is an even integer, m = 2k,
where k is also an integer.
9. Substituting, we see that (2k)2 = 2n2.
10.Simplifying and canceling 2 from both
sides gives us 2k2 = n2.
11.Therefore, n2 is even, and so n is
even.
Proof by Contradiction
12.Since n is an even integer, n = 2j,
where j is also an integer.
13.So we have now shown that m and n are
both even, that is, m = 2k and n =
2j.
14.But this is a contradiction, since
line 4 of our proof showed that the
two integers, m and n, had no common
factors.
15.Thus, or initial assumption, that 2
is rational, must be false.
16.Hence, 2 is irrational: QED.
Proof by Contradiction (Cont..)
• An indirect proof of an implication p  q can be
rewritten as a proof by contradiction.
• Assume that both p and q are true.
• Then use a direct proof to show that
q  p
• This leads to the contradiction p  p.
• Example:
– If 3n + 2 is odd, then n is odd. (see p. 81)
Mistakes in proofs
• Sometimes we cause mistakes in our proofs
by making a faulty assumtion.
• For example, there is a famous “proof” that
2 = 1 that is based on a faulty assumption.
• Given that a and b are positive integers and
a = b, what is wrong with the following
proof?
Mistakes in proof

Step Reason
a=b hypothesis
a2 = ab Multiply both sides by a
a2 – b2 = ab – b2 Subtract b2 from both sides
(a - b)(a + b) = b(a - b) Factor both sides
a+b=b Divide by (a – b)
2b = b Step 1, replace & simplify
2=1 Divide by b
Mistakes in proof
The problem here is in step 5, where we
divide both sides of the equation by (a – b).
Our original hypothesis was that a = b, so
dividing by (a – b) is dividing by zero,
which is undefined in our numbering
system.
Circular Reasoning

• One or more steps of the proof are based upon


the truth of the statement being proved.
• This fallacy arises when a stement is proven
using itself or a statement that is equivalent to
it.
• Also known as begging the question.
Circular Reasoning

• Suppose we want to prove that:


if n2 is an even integer then n is an
even integer

Assume that n2 is even


n2 = 2k for some integer k
Let n = 2j for some integer k
 n is even
Circular Reasoning
• Let’s take a closer look at the “proof” of:
if n2 is an even integer then n is an even integer

n2 is even hypothesis
n2 = 2k for some integer k Def. of even
Let n = 2j for some integer k ?
 n is even Def. of even

The problem is line 3. We have no justification for


assuming that n = 2j; in fact, that is what we are trying to
prove!
MTH 2215
Applied discrete mathematics

Chapter 1, Section 1.7


Proof Methods and Strategies
Proof Basics

• We want to establish the p q p q


truth of p  q T T T
T F F
• p may be a conjunction of
F T T
other hypotheses
F F T
• p  q is a conjecture until
a proof is produced
More Methods of Proof

• Proof by cases
• Exhaustive proof
• “Without loss of generality”
• Existence proof
• Uniqueness proof
Proof by Cases
• Break the premise of p  q into an equivalent
disjunction of the form p1  p2    pn
• Then use the equivalence
[(p1p2pn)  q]  [(p1q)(p2 q)   (pnq)]
• Each of the implications pi  q is a case.
• You must
– Convince the reader that the cases are inclusive (i.e.,
they exhaust all possibilities)
– Establish all implications
Example
• Prove that if n is an integer, then n2  n

• The basic approach here is to observe that the problem


consists of four cases: n < 0, n = 0, n = 1, n > 1
• If n < 0, then n2 is positive and thus n2  n
• If n = 0, then n2 and n = 0 and n2  n
• If n = 1, then n2 and n = 1 and n2  n
• If n > 1, then n2 = n•n, which must be greater than n
since n > 1, and thus n2  n
• Since the proposition is true for all 4 cases, it must be
true in general
Exhaustive proof
• An exhaustive proof is a special type of proof
by cases where each case involves checking a
single example
Example
• Given that n is a positive integer and n ≤ 4:
prove that (n + 1)3  3n
Here we have only 4 cases, and each case involves
a specific value of n: 1, 2, 3, and 4
• For n = 1, (n + 1)3 = 8 and 3n = 3
• For n = 2, (n + 1)3 = 27 and 3n = 9
• For n = 3, (n + 1)3 = 64 and 3n = 27
• For n = 4, (n + 1)3 = 125 and 3n = 81
These 4 cases exhaust all of the possibilities: QED
“Without Loss of Generality”

• By proving one case of a theorem, other cases


follow by
– making straightforward changes to the argument,
– or by filling in some straightforward initial step.
Example
• Show that (x+y)r < xr + yr whenever x and y
are positive real numbers and r is a real
number with 0 < r <1.
• We say: “Without loss of generality we can
assume that x + y = 1”
• Proof: (see next slide)
Example
• Proof:
x+y=1 hypothesis
0 < x < 1 and 0 < y < 1 x & y are positive
0<1–r<1 0 < r < 1 (given)
x1-r < 1 and y1-r < 1
x < xr and y < yr
x + y (which = 1) < xr + yr
(x + y)r (which = 1r) < xr + yr
Example
• In the previous slide we said: “Without loss of
generality we can assume that x + y = 1”
• How do we justify this? Well, ….
Example
We have proved the theorem assuming that
x + y = 1. Suppose x + y = t. Then we can see
that:
(x / t) + (y / t) = 1, and
((x / t) + (y / t))r = 1r = 1, so
((x / t) + (y / t))r < (x / t)r + (y / t)r
Now we multiply both sides of this by tr to get:
(x + y)r < xr + yr
Existence Proof
• The proof of xP(x) is called an existence proof.
• Constructive existence proof
– Find an element c in the universe of discourse such
that P(c) is true
• Non-constructive existence proof
– Do not find c; instead, somehow prove xP(x) is true
– Generally, we do this by contradiction
• Assume no c exists that makes P(c) true
• Derive a contradiction
Example

• There is a positive integer that can be written as


the sum of cubes of positive integers in two
different ways
1729=103 + 93 =123 + 13

• There exist irrational numbers x and y such that


xy is rational
Uniqueness Proof
• Sometimes we need to show that only one
element of a set satisfies some particular
condition
• A uniqueness proof has two parts:
– Existence: show that an element x with the desired
property exists
– Uniqueness: show that, for any y, then either y = x,
or y does not have the desired property
Example
• Show that if a and b are real numbers and a ≠ 0,
then there is a unique real number r such that
ar + b = 0.
The proof has two parts:
(1) Proof of existence:
ar + b = 0 hypothesis
ar = -b subtract b from both sides
r = -b/a divide both sides by a
a(-b/a) + b = -b + b = 0 QED
Example
(1) Proof of uniqueness:
Assume s is a real number and as + b = 0
as + b = 0 hypothesis
ar + b = as + b since both equal 0
ar = as subtract b from both sides
r=s divide both sides by a
QED
Proof strategy
• We can prove that there is no perfect strategy for
constructing a proof!
• More of an art than a science
• Requires lots of practice
• Try both forward and backward reasoning
• Try looking for counterexamples
• Adapt existing proofs that are similar to what
you want to prove
Forward and Backward Reasoning
• Forward reasoning:
– Start with premises p
– Construct a proof using a sequence of steps to
– Arrive at a conclusion q
• Backward reasoning:
– Don’t start off by assuming p and proving that q
follows
– Instead, try to prove q by finding (or proving) a
statement p for which we already know p  q
Example
• See the handout on the “15-stones” game
• The game starts with a pile of 15 stones. The
two players take turns removing 1, 2, or 3 stones
at a time from the pile. The winner is the person
who removes the last stone from the pile.
• By working backward, we can see what will
happen if she leaves only 1 stone left, then 2,
then 3, etc., all the way back to the original 15
stones.
• We deduce that the first player can always win.
Counterexamples
• Sometimes we are asked to prove something that
we suspect is not true.
• In that case, look for a counterexample first, or
you may end up wasting your time on something
that cannot be proven to be true.
• Example: “Every positive integer is the sum of
three squares of integers.”
• True for 1 (02 + 02 + 12), 2 (02 + 12 + 12), 3 (12 +
12 + 12), 4 (02 + 02 + 22), 5 (02 + 12 + 22), 6 (12 +
12 + 22), but not for 7 – counterexample!
Adapting Existing Proofs
• In Section 1.6 we proved that 2 is irrational.
• Suppose that we are asked to prove that 3 is
irrational.
• Instead of starting from scratch, you can adapt
the proof for 2; this can save you lots of time
and effort.
Recap: Direct Proof
• Assume the hypotheses are true
• Use rules of inference and any logical
equivalences to establish the truth of the
conclusion
Example

• Prove that if m + n and n + p are even


integers, then m + p is even.
Recap: Indirect Proof
• A direct proof of the contrapositive
– Remember: p  q is equivalent to ~q  ~p
– Proof ~q  ~p
• Assume that q is true i.e., q is false
• Use rules of inference and logical equivalences to
show that p is true i.e., p is false
Example

• Prove that if m and n are integers and m•n is


even, then m is even or n is even.
Recap: Vacuous Proof

• If we know one of the hypotheses in p is false


then p  q is vacuously true.
• F  T and F  F are both true.
Recap: Trivial Proof
• If we know q is true, then p  q is true
• F  T and T  T are both true.
Recap: Proof by Contradiction

• We want to prove p. What if we can prove that


p implies a contradiction q (i.e., q is FALSE no
matter what, or is absurd)?
• Mathematical definition of the proof
– Find a contradiction q such that
p  q  p  F  (p)  p
Example
• Show that there is no rational number r for
which r3 + r + 1 = 0
Conclusion
We have covered the following topics in Logic:
Propositional Logic
Propositional Equivalences
Predicates and Quantifiers
Nested Quantifiers
Rules of Inference
Introduction to Proofs
Proof Methods and Strategies

You might also like