0% found this document useful (0 votes)
12 views63 pages

2 Chap1

Uploaded by

abrar.lol789
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)
12 views63 pages

2 Chap1

Uploaded by

abrar.lol789
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/ 63

Discrete Mathematics and Its Applications

Chapter 1: The Foundations:


Logic and Proofs

1
1.3 Predicates and Quantifiers
Predicates
Statements involving variables are neither true
nor false.
E.g. “x > 3”, “x = y + 3”, “x + y = z”
“x is greater than 3”
 “x”: subject of the statement
 “is greater than 3”: the predicate
 We can denote the statement “x is greater than
3” by P(x), where P denotes the predicate and x
is the variable.
Once a value is assigned to the variable x, the
statement P(x) becomes a proposition and has a
truth value.
2
1.3 Predicates and Quantifiers
Example: Let P(x) denote the statement “x > 3.”
What are the truth values of P(4) and P(2)?
Solution: P(4) – “4 > 3”, true
P(3) – “2 > 3”, false
Example: Let Q(x,y) denote the statement “x = y
+ 3.” What are the truth values of the
propositions Q(1,2) and Q(3,0)?
Solution: Q(1,2) – “1 = 2 + 3” , false
Q(3,0) – “3 = 0 + 3”, true

3
1.3 Predicates and Quantifiers
 Example: Let A(c,n) denote the statement “Computer c is
connected to network n”, where c is a variable
representing a computer and n is a variable representing a
network. Suppose that the computer MATH1 is connected
to network CAMPUS2, but not to network CAMPUS1.
What are the values of A(MATH1, CAMPUS1) and
A(MATH1, CAMPUS2)?
Solution: A(MATH1, CAMPUS1) – “MATH1 is connect to CAMPUS1”, false
A(MATH1, CAMPUS2) – “MATH1 is connect to CAMPUS2”, true

4
1.3 Predicates and Quantifiers

A statement involving n variables x1, x2,


…, xn can be denoted by P(x1, x2, …, xn).
A statement of the form P(x1, x2, …, xn) is
the value of the propositional function P at
the n-tuple (x1, x2, …, xn), and P is also
called a n-place predicate or a n-ary
predicate.

5
1.3 Predicates and Quantifiers
Example:
“ if x > 0 then x:= x + 1”
When the statement is encountered, the
value if x is inserted into P(x).
If P(x) is true, x is increased by 1.
If P(x) is false, x is not changed.

6
1.3 Predicates and Quantifiers
Quantifiers
Quantification: express the extent to which
a predicate is true over a range of
elements.
Universal quantification: a predicate is
true for every element under consideration
Existential quantification: a predicate is
true for one or more element under
consideration
A domain must be specified.
7
1.3 Predicates and Quantifiers
DEFINITION 1
The universal quantification of P(x) is the statement
“P(x) for all values of x in the domain.”
The notation xP(x) denotes the universal quantification of P(x). Here  is
called the Universal Quantifier. We read xP(x) as “for all xP(x)” or “for
every xP(x).” An element for which P(x) is false is called a counterexample
of xP(x).

Example: Let P(x) be the statement “x + 1 > x.” What is the


truth value of the quantification xP(x), where the domain

consists of all real numbers?

Solution: Because P(x) is true for all real numbers, the


quantification is true. 8
1.3 Predicates and Quantifiers

 A statement  xP(x) is false, if and only if P(x) is not


always true where x is in the domain. One way to show
that is to find a counterexample to the statement  xP(x).
 Example: Let Q(x) be the statement “x < 2”. What is the
truth value of the quantification  xQ(x), where the domain
consists of all real numbers?
Solution: Q(x) is not true for every real numbers, e.g. Q(3) is
false. x = 3 is a counterexample for the statement xQ(x). 
Thus the quantification is false.

 xP(x) is the same as the conjunction


P(x1) Λ P(x2) Λ …. Λ P(xn) 9
1.3 Predicates and Quantifiers

Example: What does the statement  xN(x) mean if


N(x) is “Computer x is connected to the network”
and the domain consists of all computers on
campus?
Solution: “Every computer on campus is connected to the
network.”

10
1.3 Predicates and Quantifiers
DEFINITION 2
The existential quantification of P(x) is the statement
“There exists an element x in the domain such that P(x).”
We use the notation xP(x) for the existential quantification of P(x). Here
 is called the Existential Quantifier.
• The existential quantification xP(x) is read as 
“There is an x such that P(x),” or
“There is at least one x such that P(x),” or
“For some x, P(x).”

11
1.3 Predicates and Quantifiers
 Example: Let P(x) denote the statement “x > 3”. What is
the truth value of the quantification xP(x), where the
domain consists of all real numbers?
Solution: “x > 3” is sometimes true – for instance when
x = 4. The existential quantification is true.
  xP(x) is false if and only if P(x) is false for every element
of the domain.
 Example: Let Q(x) denote the statement “x = x + 1”. What
is the true value of the quantification  xQ(x), where the
domain consists for all real numbers?
Solution: Q(x) is false for every real number. The existential
quantification is false. 12
1.3 Predicates and Quantifiers
 If the domain is empty, xQ(x) is false because there can
be no element in the domain for which Q(x) is true.
 The existential quantification xP(x) is the same as the
disjunction P(x1) V P(x2) V … VP(xn)

Quantifiers
Statement When True? When False?

xP(x) xP(x) is true for every x. There is an x for which xP(x)


is false.
xP(x) There is an x for which P(x) is P(x) is false for every x.
true.

 13
Uniqueness Quantifier

• !x P(x) means that P(x) is true for one and only one x
in the universe of discourse.
• This is commonly expressed in English in the following
equivalent ways:
“There is a unique x such that P(x).”
“There is one and only one x such that P(x)”

1.If P(x) denotes “x + 1 = 0” and U is the integers,


• Examples:

then !x P(x) is true.


2.But if P(x) denotes “x > 0,” then !x P(x) is false.

14
Properties of Quantifiers
The truth value of x P(x) and  x P(x) depend
on both the propositional function P(x) and
on the domain U.
Examples:

“x < 2”, then x P(x) is true, but  x P(x) is false.


¡ If U is the positive integers and P(x) is the statement

“x < 2”, then both x P(x) and  x P(x) are true.


¡ If U is the negative integers and P(x) is the statement

If U consists of 3, 4, and 5, and P(x) is the statement


“x > 2”, then both x P(x) and  x P(x) are true.
¡

But if P(x) is the statement “x < 2”, then both x P(x)


and  x P(x) are false.

15
Precedence of Quantifiers
The quantifiers  and  have higher

For example, x P(x) ∨ Q(x) means (x


precedence than all the logical operators.

P(x))∨ Q(x)
x (P(x) ∨ Q(x)) means something
different.
Unfortunately, often people write x
P(x) ∨ Q(x) when they mean  x (P(x)
∨ Q(x)).
Translating from English to Logic
Example 1: Translate the following sentence
into predicate logic: “Every student in this
class has taken a course in Java.”
Solution:

Solution 1: If U is all students in this class, define a


First decide on the domain U.

course in Java” and translate as x J(x).


propositional function J(x) denoting “x has taken a

Solution 2: But if U is all people, also define a


in this class” and translate as x (S(x)→ J(x)).
propositional function S(x) denoting “x is a student

x (S(x) ∧ J(x)) is not correct. What does it


mean?
Translating from English to Logic
Example 2: Translate the following sentence
into predicate logic: “Some student in this
class has taken a course in Java.”
Solution:

Solution 1: If U is all students in this class, translate


First decide on the domain U.

x J(x)
as

Solution 2: But if U is all people, then translate as


x (S(x) ∧ J(x))
x (S(x)→ J(x)) is not correct. What does it
mean?
Returning to the Socrates Example
Introduce the propositional functions
Man(x) denoting “x is a man” and
Mortal(x) denoting “x is mortal.” Specify
the domain as all people.
The two premises are:

The conclusion is:


Equivalences in Predicate Logic
Statements involving predicates and
quantifiers are logically equivalent if and only
if they have the same truth value
for every predicate substituted into these
statements and
for every domain of discourse used for the variables

The notation S ≡T indicates that S and T


in the expressions.

are logically equivalent.


Example: x ¬¬S(x) ≡ x S(x)
Negating Quantified Expressions
Consider x J(x)

Here J(x) is “x has taken a course in Java” and


“Every student in your class has taken a course in Java.”

the domain is students in your class.


Negating the original statement gives “It is not the
case that every student in your class has taken
Java.” This implies that “There is a student in your

Symbolically ¬x J(x) and x ¬J(x) are


class who has not taken Java.”

equivalent
Negating Quantified Expressions
(continued)
Now Consider  x J(x)
“There is a student in this class who has taken a

Where J(x) is “x has taken a course in Java.”


course in Java.”

Negating the original statement gives “It is


not the case that there is a student in this
class who has taken Java.” This implies that
“Every student in this class has not taken

Symbolically ¬ x J(x) and  x ¬J(x)


Java”

are equivalent
De Morgan’s Laws for Quantifiers
The rules for negating quantifiers are:

The reasoning in the table shows that:

These are important. You will use these.


Translation from English to Logic
Examples:
1.“Some student in this class has visited
Mexico.”
Solution: Let M(x) denote “x has visited Mexico”
U be all people.
and S(x) denote “x is a student in this class,” and

x (S(x) ∧ M(x))
2.“Every student in this class has visited
Canada or Mexico.”

x (S(x)→ (M(x)∨C(x)))
Solution: Add C(x) denoting “x has visited Canada.”
Lewis Carroll Example
Charles Lutwidge
Dodgson
The first two are called premises and(AKA
theLewis
third is
Caroll)
called the conclusion. (1832-1898)
1. “All lions are fierce.”
2. “Some lions do not drink coffee.”
3. “Some fierce creatures do not drink coffee.”
Here is one way to translate these statements to
predicate logic. Let P(x), Q(x), and R(x) be the
propositional functions “x is a lion,” “x is fierce,”

1. x (P(x)→ Q(x))
and “x drinks coffee,” respectively.

2. x (P(x) ∧ ¬R(x))
3. x (Q(x) ∧ ¬R(x))
Later we will see how to prove that the conclusion
follows from the premises.
Nested Quantifiers
Nested quantifiers are often necessary to express
the meaning of sentences in English as well as
important concepts in computer science and
mathematics.

x y(x + y = 0)
Example: “Every real number has an inverse” is

where the domains of x and y are the real


numbers.
We can also think of nested propositional functions:
x y(x + y = 0) can be viewed as x Q(x) where Q(x)
is y P(x, y) where P(x, y) is (x + y = 0)
Thinking of Nested Quantification

 To see if xyP (x,y) is true, loop through the values of x


 Nested Loops

:
 At each step, loop through the values for y.
 If for some pair of x andy, P(x,y) is false, then x yP(x,y) is false

x y P(x,y) is true if the outer loop ends after stepping


and both the outer and inner loop terminate.

through each x.
 To see if x yP(x,y) is true, loop through the values of x:
At each step, loop through the values for y.
The inner loop ends when a pair x and y is found such that
P(x, y) is true.
If no y is found such that P(x, y) is true the outer loop
terminates as x yP(x,y) has been shown to be false.
x y P(x,y) is true if the outer loop ends after stepping
through each x.
 If the domains of the variables are infinite, then this
process can not actually be carried out.
Order of Quantifiers

1.Let P(x,y) be the statement “x + y = y +


Examples:

x.” Assume that U is the real numbers.


Then x yP(x,y) and y xP(x,y)

2.Let Q(x,y) be the statement “x + y = 0.”


have the same truth value.

Assume that U is the real numbers. Then


x yQ(x,y) is true, but y xQ(x,y) is
false.
Questions on Order of Quantifiers
Example 1: Let U be the real numbers,
Define P(x,y) : x ∙ y = 0
What is the truth value of the following:
1. xyP(x,y)
Answer: False
2. xyP(x,y)

3. xy P(x,y)
Answer: True

4. x  y P(x,y)
Answer: True

Answer: True
Questions on Order of Quantifiers
Example 2: Let U be the real numbers,
Define P(x,y) : x / y = 1
What is the truth value of the following:
1. xyP(x,y)
Answer: False
2. xyP(x,y)

3. xy P(x,y)
Answer: False

4. x  y P(x,y)
Answer: False

Answer: True
Quantifications of Two Variables

Statement When True? When False


P(x,y) is true for every There is a pair x, y for
pair x,y. which P(x,y) is false.

For every x there is a y There is an x such that


for which P(x,y) is true. P(x,y) is false for every
y.
There is an x for which For every x there is a y
P(x,y) is true for every y. for which P(x,y) is false.
There is a pair x, y for P(x,y) is false for every
which P(x,y) is true. pair x,y
Translating Nested Quantifiers into
English

x (C(x )∨ y (C(y ) ∧ F(x, y)))


Example : Translate the statement

where C(x) is “x has a computer,” and F(x,y) is “x


and y are friends,” and the domain for both x and y
consists of all students in your school.
Solution: Every student in your school has a
computer or has a friend who has a computer.
Translating Mathematical Statements into
Predicate Logic
Example : Translate “The sum of two positive integers
is always positive” into a logical expression.
Solution:
1. Rewrite the statement to make the implied quantifiers and
domains explicit:
“For every two integers, if these integers are both positive, then the sum
of these integers is positive.”
2. Introduce the variables x and y, and specify the domain, to
obtain:
“For all positive integers x and y, x + y is positive.”

x  y ((x > 0)∧ (y > 0)→ (x + y > 0))


3. The result is:

where the domain of both variables consists of all integers


Translating English into Logical
Expressions Example
Example: Use quantifiers to express the
statement “There is a woman who has taken
a flight on every airline in the world.”
Solution:
1. Let P(w,f) be “w has taken f ” and Q(f,a) be “f is
a flight on a .”
2. The domain of w is all women, the domain of f is all
flights, and the domain of a is all airlines.

w a f (P(w,f ) ∧ Q(f,a))
3. Then the statement can be expressed as:
Questions on Translation from English

Example 1: “Brothers are siblings.”


Choose the obvious predicates and express in predicate logic.

Solution: x y (B(x,y) → S(x,y))


Example 2: “Siblinghood is symmetric.”
Solution: x y (S(x,y) → S(y,x))
Example 3: “Everybody loves somebody.”

Example 4: “There is someone who is loved by everyone.”


Solution: x y L(x,y)

Example 5: “There is someone who loves someone.”


Solution: y x L(x,y)

Example 6: “Everyone loves himself”


Solution: x y L(x,y)

Solution: x L(x,x)
Rules of Inference
Revisiting the Socrates Example
We have the two premises:
“All men are mortal.”
“Socrates is a man.”
And the conclusion:
“Socrates is mortal.”
How do we get the conclusion from the
premises?
The Argument
We can express the premises (above the line)
and the conclusion (below the line) in
predicate logic as an argument:

We will see shortly that this is a valid


argument.
Arguments in Propositional Logic
 A argument in propositional logic is a sequence of
propositions. All but the final proposition are called premises.
The last statement is the conclusion.
 The argument is valid if the premises imply the conclusion.
An argument form is an argument that is valid no matter
what propositions are substituted into its propositional

 If the premises are p1 ,p2, …,pn and the conclusion is q


variables.

(p1 ∧ p2 ∧ … ∧ pn ) → q is a tautology.
then

 Inference rules are all argument simple argument forms that


will be used to construct more complex argument forms.
Rules of Inference for Propositional Logic:
Modus Ponens

(p ∧ (p →q)) → q
Corresponding Tautology:

Example:
Let p be “It is snowing.”
Let q be “I will study discrete math.”

“If it is snowing, then I will study discrete math.”


“It is snowing.”

“Therefore , I will study discrete math.”


Modus Tollens

(¬q∧(p →q))→¬p
Corresponding Tautology:

Example:
Let p be “it is snowing.”
Let q be “I will study discrete math.”

“If it is snowing, then I will study discrete math.”


“I will not study discrete math.”

“Therefore , it is not snowing.”


Hypothetical Syllogism

((p →q) ∧ (q→r))→(p→ r)


Corresponding Tautology:

Example:
Let p be “it snows.”
Let q be “I will study discrete math.”
Let r be “I will get an A.”

“If it snows, then I will study discrete math.”


“If I study discrete math, I will get an A.”

“Therefore , If it snows, I will get an A.”


Disjunctive Syllogism

(¬p∧(p ∨q))→q
Corresponding Tautology:

Example:
Let p be “I will study discrete math.”
Let q be “I will study English literature.”

“I will study discrete math or I will study English literature.”


“I will not study discrete math.”

“Therefore , I will study English literature.”


Addition

p →(p ∨q)
Corresponding Tautology:

Example:
Let p be “I will study discrete math.”
Let q be “I will visit Las Vegas.”

“I will study discrete math.”

“Therefore, I will study discrete math or I will visit


Las Vegas.”
Simplification

(p∧q) →p
Corresponding Tautology:

Example:
Let p be “I will study discrete math.”
Let q be “I will study English literature.”

“I will study discrete math and English literature”

“Therefore, I will study discrete math.”


Conjunction

((p) ∧ (q)) →(p ∧ q)


Corresponding Tautology:

Example:
Let p be “I will study discrete math.”
Let q be “I will study English literature.”

“I will study discrete math.”


“I will study English literature.”

“Therefore, I will study discrete math and I will study


English literature.”
Introduction to Proofs
Section 1.7
Section Summary
Mathematical Proofs
Forms of Theorems
Direct Proofs
Indirect Proofs
Proof of the Contrapositive
Proof by Contradiction
Proofs of Mathematical Statements
 A proof is a valid argument that establishes the truth of a
statement.
 In math, CS, and other disciplines, informal proofs which are
generally shorter, are generally used.
 More than one rule of inference are often used in a step.
 Steps may be skipped.
 The rules of inference used are not explicitly stated.
 Easier for to understand and to explain to people.
 But it is also easier to introduce errors.
 Proofs have many practical applications:
 verification that computer programs are correct
 establishing that operating systems are secure
 enabling programs to make inferences in artificial intelligence
 showing that system specifications are consistent
Definitions
 A theorem is a statement that can be shown to be true using:
 definitions
 other theorems
 axioms (statements which are given as true)
 rules of inference
 A lemma is a ‘helping theorem’ or a result which is needed to
prove a theorem.
 A corollary is a result which follows directly from a theorem.
 Less important theorems are sometimes called propositions.
 A conjecture is a statement that is being proposed to be true.
Once a proof of a conjecture is found, it becomes a theorem.
It may turn out to be false.
Forms of Theorems
Many theorems assert that a property holds for all
elements in a domain, such as the integers, the
real numbers, or some of the discrete structures
that we will study in this class.
Often the universal quantifier (needed for a
precise statement of a theorem) is omitted by
standard mathematical convention.
For example, the statement:
“If x > y, where x and y are positive real numbers, then x2 > y2 ”
really means
“For all positive real numbers x and y, if x > y, then x2 > y2 .”
Proving Theorems
Many theorems have the form:

To prove them, we show that where c is


an arbitrary element of the domain,
By universal generalization the truth of the
original formula follows.
So, we must prove something of the form:
p→q
Proving Conditional Statements:

p → q is true as well.
 Trivial Proof: If we know q is true, then

“If it is raining then 1=1.”

p → q is true as well.
 Vacuous Proof: If we know p is false then

“If I am both rich and poor then 2 + 2 = 5.”

[ Even though these examples seem silly, both trivial and


vacuous proofs are often used in mathematical induction, as
we will see in Chapter 5) ]
Even and Odd Integers

integer k such that n = 2k, and n is odd if there exists an


Definition: The integer n is even if there exists an

integer k, such that n = 2k + 1. Note that every integer is


either even or odd and no integer is both even and odd.

We will need this basic fact about the integers in some of


the example proofs to follow. We will learn more about
the integers in Chapter 4.
p→q
Proving Conditional Statements:

 Direct Proof: Assume that p is true. Use rules of


inference, axioms, and logical equivalences to show that
q must also be true.
Example: Give a direct proof of the theorem “If n is an

Solution: Assume that n is odd. Then n = 2k + 1 for an


odd integer, then n2 is odd.”

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


integer k. Squaring both sides of the equation, we get:

+ 1,
where r = 2k2 + 2k , an integer.

We have proved that if n is an odd integer, then n2 is an


odd integer.
Proving Conditional Statements: p → q
Definition: The real number r is rational if there
exist integers p and q where q≠0 such that r =
p/q
Example: Prove that the sum of two rational
numbers is rational.
Solution: Assume r and s are two rational
numbers. Then there must be integers p, q and
also t, u such that

where v = pu + qt
w = qu ≠ 0
Thus the sum is rational.
p→q
Proving Conditional Statements:

 Proof by Contraposition: Assume ¬q and show ¬p is true also.


direct proof of ¬q → ¬p then we have a proof of p → q.
This is sometimes called an indirect proof method. If we give a

Example: Prove that if n is an integer and 3n + 2 is odd, then n is


Why does this work?

Solution: Assume n is even. So, n = 2k for some integer k. Thus


odd.

3n + 2 = 3(2k) + 2 =6k +2 = 2(3k + 1) = 2j for j = 3k +1


Therefore 3n + 2 is even. Since we have shown ¬q → ¬p , p →
q must hold as well. If n is an integer and 3n + 2 is odd (not
even) , then n is odd (not even).
Proving Conditional Statements: p → q
Example: Prove that for an integer n, if n2 is odd,
then n is odd.
Solution: Use proof by contraposition. Assume n
integer k such that n = 2k. Hence,
is even (i.e., not odd). Therefore, there exists an

n2 = 4k2 = 2 (2k2)
and n2 is even(i.e., not odd).
We have shown that if n is an even integer, then
n2 is even. Therefore by contraposition, for an
integer n, if n2 is odd, then n is odd.
Proving Conditional Statements: p → q

To prove p, assume ¬p and derive a contradiction such as


 Proof by Contradiction:

p ∧ ¬p. (an indirect form of proof). Since we have


shown that ¬p →F is true , it follows that the contrapositive
T→p also holds.
Example: Prove that if you pick 22 days from the calendar, at
least 4 must fall on the same day of the week.
Solution: Assume that no more than 3 of the 22 days fall on
the same day of the week. Because there are 7 days of the
week, we could only have picked 21 days. This contradicts
the assumption that we have picked 22 days.
Proof by Contradiction

Example: Use a proof by contradiction to give a proof that √2 is


 A preview of Chapter 4.

irrational.
Solution: Suppose √2 is rational. Then there exists integers a
and b with √2 = a/b, where b≠ 0 and a and b have no common
factors (see Chapter 4). Then

Therefore a2 must be even. If a2 is even then a must be even


(an exercise). Since a is even, a = 2c for some integer c. Thus,

Therefore b2 is even. Again then b must be even as well.


But then 2 must divide both a and b. This contradicts our
assumption that a and b have no common factors. We have
proved by contradiction that our initial assumption must be
false and therefore √2 is irrational .
Proof by Contradiction
A preview of Chapter 4.
Example: Prove that there is no largest prime
number.
Solution: Assume that there is a largest prime

primes 2,3,.., pn. Form


number. Call it pn. Hence, we can list all the

None of the prime numbers on the list divides r.


Therefore, by a theorem in Chapter 4, either r is
prime or there is a smaller prime that divides r.
This contradicts the assumption that there is a
largest prime. Therefore, there is no largest prime.
Theorems that are Biconditional
Statements

that is, a statement of the form p ↔ q, we show that


To prove a theorem that is a biconditional statement,

p → q and q →p are both true.


Example: Prove the theorem: “If n is an
integer, then n is odd if and only if n2 is odd.”
Solution: We have already shown (previous
slides) that both p →q and q →p. Therefore we
can conclude p ↔ q.

Sometimes iff is used as an abbreviation for “if an only if,” as in


“If n is an integer, then n is odd iif n2 is odd.”
What is wrong with this?

“Proof” that 1 = 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy