Professional Documents
Culture Documents
1.4
Predicates and Quantifiers
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 39
1.4 Predicates and Quantifiers
Propositional logic, cannot adequately express meaning
of all statements: Drawback
More powerful logic: “Predicate Logic”
Predicates:
◼ Consider Statements involving variables:
“x > 3,” “x = y + 3,” “x + y = z”
“Computer x is under attack by an intruder”
“Computer x is functioning properly”
◼ Neither true nor false, if values of variables are not specified
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 40
1.4 Predicates and Quantifiers
Ex 1: P(x): Statement “x > 3”
◼ Truth values of P (4) and P (2)?
Sol:
◼ P(4), for x = 4 : “4 > 3” : True
◼ P(2), for x =2 : “2 > 3” : False
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 41
1.4 Predicates and Quantifiers
Ex 3: Q(x, y): “x = y + 3”
◼ Truth values of propositions Q(1, 2) and Q(3, 0)?
Sol:
◼ Q(1, 2), for x = 1 & y = 2 : “1 = 2 + 3,” : False
◼ Q(3, 0): “3 = 0 + 3” : True
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 42
1.4 Predicates and Quantifiers
Ex 5: R(x, y, z): “x + y = z”
◼ Truth values of R(1, 2, 3) and R(0, 0, 1)?
Sol:
◼ R(1, 2, 3): “1 + 2 = 3” : True
◼ R(0, 0, 1): “0 + 0 = 1” : False
Ex 6: if x > 0 then x := x + 1 (in computer programs)
◼ Value of x at that point is inserted into P(x)
If P(x), True: x := x + 1 is executed, x is increased by 1
If P(x), False: x := x + 1 is not executed, x is unchanged
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 44
1.4 Predicates and Quantifiers
Quantifiers: Expresses extent to which predicate is True over a
range of elements:
◼ In English: Words:
All, some, many, none, and few
◼ Universal quantification: Predicate is true for every element
under consideration
◼ Existential quantification: There is one or more element
under consideration for which the predicate is true
Ex 8: P(x): “x + 1 > x”
◼ ∀x P(x) ? Domain: All real numbers
Sol: P(x) True for all real numbers x: ∀x P(x) : True
Ex 9: Q(x): “x < 2”
◼ ∀x Q(x), Domain: All real numbers
Solution: Q(x) not True for every real number x:
◼ For instance, Q(3) : False
◼ x = 3, Counterexample for statement ∀x Q(x)
◼ ∀x Q(x) : False
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 46
1.4 Predicates and Quantifiers
Ex 10: P(x): “x2 > 0” Show, ∀xP(x) : False
◼ Domain (Universe of discourse): All integers
Sol: A counterexample: x2 is not > 0 when x = 0
Ex 11: ∀x P(x) ?
◼ If P(x): “x2 < 10”, For positive integers not exceeding 4
Sol: ∀x P(x) ≈ P(1) ∧ P(2) ∧ P(3) ∧ P(4)
◼ Domain: 1, 2, 3, 4
◼ P(4): “42 < 10” , False:
◼ ∀x P(x) is False
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 47
1.4 Predicates and Quantifiers
Ex 12: ∀x N(x) ?
◼ N(x): “Computer x is connected to network”
◼ Domain: All computers on campus
Sol: “Every computer on campus is connected to network”
Ex 13: ∀x(x2 ≥ x) ?
1. Domain: All real numbers
2. Domain: All integers
Sol:
1. False: Ex:
2. True:
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 48
1.4 Predicates and Quantifiers
Ex 14: P(x) : “x > 3” ; ∃x P(x) ? Domain: All real numbers
Sol: “x > 3”, True, for instance : x = 4; ∃x P(x) : True
Ex 15: Q(x) : “x=x + 1” ; ∃xQ(x) ? Domain: All real numbers
Sol: Q(x): False, for every real number x; ∃x Q(x) : False
∃x P(x): Domain Elements:
◼ x1, x2,...,xn : Following Disjunction is True:
◼ P(x1) ∨ P(x2) ∨···∨ P(xn):
◼ If and only if at least one of P (x1), P (x2), . . . , P (xn) : True
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 51
1.4 Predicates and Quantifiers
Ex 20: Find Negations of:
1. “There is an honest politician”
2. “All Americans eat cheeseburgers”
Sol:
1. H(x): “x is honest”; ∃x H(x): “There is an honest politician”
¬∃x H(x) ≈ ∀x ¬H(x): “Not all politicians are honest”
2. C(x): “x eats cheeseburgers”; ∀x C(x): “All Americans eat
cheeseburgers”
¬∀x C(x) ≈ ∃x¬C(x): “There is an American who does not eat
cheeseburgers”
Ex 21: Find Negations of:∀x(x2 > x) and ∃x(x2 = 2)
Sol:
◼ Negation of ∀x(x2 > x) ≈ ¬∀x(x2 > x) ≈ ∃x¬(x2 > x) ≈
∃x(x2 ≤ x)
◼ Negation of ∃x(x2 = 2) ≈ ¬∃x(x2 = 2) ≈ ∀x¬(x2 = 2) ≈
∀x(x2 ≠ 2)
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 52
1.4 Predicates and Quantifiers
Ex 22: Show: ¬∀x (P(x) → Q(x)) and ∃x (P(x) ∧ ¬Q(x))
◼ Logically equivalent
Sol:
◼ Fifth logical equivalence, Table 7, Section 1.3:
¬(P(x) → Q(x)) and P(x) ∧ ¬Q(x) are logically equivalent
◼ It follows: ¬∀x(P (x) → Q(x)) and ∃x(P (x) ∧ ¬Q(x)) are
logically equivalent
Translating from English into Logical Expressions
Ex 23: Express using predicates and quantifiers:
◼ “Every student in this class has studied calculus”
Sol: ∀x (S(x) → Q(x, calculus))
◼ “For every person x, if person x is a student in this class
then x has studied calculus”
S(x): Person x, in this class
Q(x, y): Student x has studied subject y (y: Calculus)
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 53
1.4 Predicates and Quantifiers
Ex 24: Express using predicates and quantifiers:
1. “Some student in this class has visited Mexico”
2. “Every student in this class has visited either Canada or
Mexico”
Sol:
1. ∃x (S(x) ∧ M(x))
“There is a person x having the properties that x is a
student in this class and x has visited Mexico”
◼ S(x) : “x is a student in this class”
◼ M(x) : “x has visited Mexico”
2. ∀x(S(x) → (C(x) ∨ M(x)))
“For every person x, if x is a student in this class, then x
has visited Mexico or x has visited Canada”
◼ S(x) : “x is a student in this class”
◼ C(x) : “x has visited Canada”
◼ M(x) : “x has visited Mexico”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 54
1.4 Predicates and Quantifiers
Using Quantifiers in System Specifications
Ex 25: Express using predicates and quantifiers:
1. “Every mail message larger than one megabyte will be
compressed”
2. “If a user is active, at least one network link will be
available”
Sol:
1. ∀m (S(m, 1) → C(m))
S(m, y) : “Mail message m is larger than y megabytes”
C(m) : “Mail message m will be compressed”
2. ∃u A(u) → ∃n S(n, available)
A(u) : “User u is active”
S(n, x) : “Network link n is in state x”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 55
1.4 Predicates and Quantifiers
Ex 26: First two : Premises, Third : Conclusion, Entire set :
Argument
◼ P(x) : “x is a lion”, Q(x) : “x is fierce”, R(x) : “x drinks coffee”
1. “All lions are fierce” : ∀x (P(x) → Q(x))
2. “Some lions do not drink coffee” : ∃x (P(x) ∧ ¬R(x))
3. “Some fierce creatures do not drink coffee” : ∃x (Q(x) ∧ ¬R(x))
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 56
Section Summary
1.4 Predicates and Quantifiers
◼ Predicates
◼ Variables
◼ Quantifiers
◼ Universal Quantifier
◼ Existential Quantifier
◼ Negating Quantifiers
◼ De Morgan’s Laws for Quantifiers
◼ Translating English to Logic
Next Section:
◼ 1.5 Nested Quantifiers
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 57
Chapter-1:
The Foundations: Logic and Proofs
1.5
Nested Quantifiers
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 58
1.5 Nested Quantifiers
Nested quantifiers:
◼ One quantifier within scope of another: Ex: ∀x ∃y (x + y = 0)
◼ Considered as propositional function, Above proposition:
∀x Q(x), Where Q(x): ∃y P(x, y) Where P(x, y): x + y = 0
Understanding Statements Involving Nested Quantifiers
Ex 1: Domain: variables x & y : consists All real numbers
1. ∀x ∀y (x + y = y + x) : x + y = y + x for all x and y
Commutative law for addition of real numbers
2. ∀x ∃y (x + y = 0) : For every x there is y such that x + y = 0
Every real number has an additive inverse
3. ∀x ∀y ∀z (x + (y + z) = (x + y) + z)
Associative law for addition of real numbers
Ex 2: Translate into English statement:
◼ ∀x ∀y ((x > 0) ∧ (y < 0) → (xy < 0)), Domain: All real numbers
Sol: “The product of a positive real number and a negative real
number is always a negative real number”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 59
1.5 Nested Quantifiers
Ex 3: P(x, y): “x + y = y + x”, Domain: All real numbers
◼ Find ∀x ∀y P(x, y) and ∀y ∀x P(x, y)
Sol: P(x, y), true for all x and y,∀x ∀y P(x, y) : True
◼ ∀y ∀x P(x, y):
“For all real numbers y, for all real numbers x, x + y = y + x” ≈
“For all real numbers x, for all real numbers y, x + y = y + x”
∀x ∀y P(x, y) & ∀y ∀x P(x, y) have same meaning, and both True
Ex 4: Q(x, y) : “x + y = 0”, Domain: All real numbers
◼ Find ∃y ∀x Q(x, y) and ∀x ∃y Q(x, y)
Sol:
◼ ∃y ∀x Q(x, y): “There is a real number y such that for every real
number x, Q(x, y)”
No real number y such that x + y = 0 for all real numbers x: False
◼ ∀x ∃y Q(x, y): “For every real number x there is a real number y
such that Q(x, y)”
For any x, there is a y: such that x + y = 0; namely, y = −x: True
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 60
1.5 Nested Quantifiers
Table 1 summarizes meanings of different possible
quantifications involving two variables:
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 61
1.5 Nested Quantifiers
Ex 5: Q(x, y, z): “x + y = z”, Domain: All real numbers
◼ Find ∀x ∀y ∃z Q(x, y, z) and ∃z ∀x ∀y Q(x, y, z)
Sol:
◼ If x & y, assigned values : There exists z such that x + y = z
◼ ∀x ∀y ∃z Q(x, y, z) :
“For all real numbers x and for all real numbers y there is a real
number z such that x + y = z” : True
◼ ∃z ∀x ∀y Q(x, y, z) :
“There is a real number z such that for all real numbers x and for
all real numbers y it is true that x + y = z” : False
No value of z, satisfies equation x + y = z for all values of x and y
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 63
1.5 Nested Quantifiers
Ex 10: Translate: ∃x ∀y ∀z ((F(x, y) ∧ F(x, z) ∧ (y ≠ z)) → ¬F(y, z))
◼ F(a, b) : a & b are friends, Domain, x, y, z: all students in school
Sol:
1. If x and y are friends, and x and z are friends, and, if y and z are
not the same student, then y and z are not friends
2. There is a x such that for all y and all z other than y, if x and y
are friends and x and z are friends, then y and z are not friends
3. There is a student none of whose friends are also friends with
each other
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 65
1.5 Nested Quantifiers
Ex 15: Express: “There does not exist a woman who has
taken a flight on every airline in the world”
Sol:
◼ P(w, f) : “w has taken f ” and Q(f, a) : “f is a flight on 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))
≡ ∀w ∃a ∀f (¬P(w, f) ∨ ¬Q(f, a))
◼ “For every woman there is an airline such that for all flights,
this woman has not taken that flight or that flight is not on
this airline”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 66
Section Summary
1.5 Nested Quantifiers
◼ Nested Quantifiers
◼ Order of Quantifiers
◼ Translating from Nested Quantifiers into English
◼ Translating Mathematical Statements into
Statements involving Nested Quantifiers
◼ Translated English Sentences into Logical
Expressions
◼ Negating Nested Quantifiers
Next Section:
◼ 1.6 Rules of Inference
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 67
Chapter-1:
The Foundations: Logic and Proofs
1.6
Rules of Inference
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 68
1.6 Rules of Inference
Introduction
Proofs: Valid arguments
◼ Establishs truth of mathematical statements
Argument: Sequence of propositions, end with conclusion
Valid Argument: if the truth of all its premises implies that the
conclusion is true
Premises: All, excluding final proposition in the argument
Conclusion: Final proposition in the argument
Rules of Inference: Basic tools for establishing truth of
statements (Used to produce valid arguments)
Fallacies: Common forms of incorrect reasoning
◼ Lead to invalid arguments
Argument form: Sequence of compound propositions involving
propositional variables
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 70
1.6 Rules of Inference
Rules of Inference for Propositional Logic
Can always use truth table to validate the 'Argument Form'
◼ But, can be a tedious approach
◼ Ex: If an argument form involves 10 propositional variables:
Requires 210 = 1024 different rows
◼ Instead, Rules of inference can be used
Ex 1: Conditional statement “If it snows today, then we will go
skiing” and its hypothesis, “It is snowing today” are True ?
◼ By modus ponens: Conclusion, “We will go skiing” is True
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 72
1.6 Rules of Inference
Ex: Modus Ponens:
◼ p: “It is snowing”
◼ q: “I will study discrete math”
◼ “If it is snowing, then I will study discrete math”
“It is snowing”, Therefore , “I will study discrete math”
Ex: Modus Tollens:
◼ p: “It is snowing”
◼ q: “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”
Ex: Hypothetical Syllogism:
◼ p: “It snows”
◼ q: “I will study discrete math”
◼ r: “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”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 73
1.6 Rules of Inference
Ex: Disjunctive Syllogism:
◼ p: “I will study discrete math”
◼ q: “I will study English literature”
◼ “I will study discrete math or I will study English literature”
“I will not study discrete math”, ∴ “I will study English literature”
Ex: Addition:
◼ p: “I will study discrete math”
◼ q: “I will visit Las Vegas”
◼ “I will study discrete math”
Therefore, “I will study discrete math or I will visit Las Vegas”
Ex: Simplification:
◼ p: “I will study discrete math”
◼ q: “I will study English literature”
◼ “I will study discrete math and English literature”
Therefore, “I will study discrete math”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 74
1.6 Rules of Inference
Ex: Conjunction:
◼ p: “I will study discrete math”
◼ q: “I will study English literature”
◼ “I will study discrete math”
◼ “I will study English literature”
∴ “I will study discrete math and I will study English literature”
Ex: Resolution:
◼ p: “I will study discrete math”
◼ r: “I will study English literature”
◼ q: “I will study databases”
◼ “I will not study discrete math or I will study English literature”
◼ “I will study discrete math or I will study databases”
∴ “I will study databases or I will study English literature”
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 75
1.6 Rules of Inference
Using Rules of Inference to Build Arguments
Ex 6: Premises:
◼ “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”
◼ Conclusion: “We will be home by sunset”
Sol:
◼ 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
◼ Premises (Hypotheses):
¬p ∧ q, r → p, ¬r → s, s → t
◼ Conclusion: t
◼ Argument can be constructed:
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 76
1.6 Rules of Inference
Ex 7: Premises:
◼ “If you send me an e-mail message, then I will finish writing the
◼ program”
◼ “If you do not send me an e-mail message, then I will go to sleep
early”
◼ “If I go to sleep early, then I will wake up feeling refreshed”
◼ Conclusion: “If I do not finish writing the program, then I will wake
up feeling refreshed”
Sol:
◼ p: You send me an e-mail message
◼ q: I will finish writing the program
◼ r: I will go to sleep early
◼ s: I will wake up feeling refreshed
◼ Premises:
p → q, ¬p → r, and r → s
◼ Desired conclusion: ¬q → s
◼ Argument form:
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 77
1.6 Rules of Inference
Ex 8: Use resolution to show that the hypotheses:
◼ “Jasmine is skiing or it is not snowing” and
◼ “It is snowing or Bart is playing hockey” imply that
◼ “Jasmine is skiing or Bart is playing hockey”
Sol:
◼ p: “It is snowing”, q: “Jasmine is skiing”, r: “Bart is playing hockey”
◼ Represent hypotheses: ¬p ∨ q and p ∨ r,
◼ Using resolution, proposition q ∨ r :
“Jasmine is skiing or Bart is playing hockey” follows
Ex 9: Show: premises (p ∧ q) ∨ r & r → s imply conclusion p ∨ s
Sol: (Clause: disjunction of variables or negations of these variables)
◼ Rewrite premises, (p ∧ q) ∨ r as two clauses:
p ∨ r and q ∨ r
◼ Replace r → s by equivalent clause ¬r ∨ s
◼ Using, clauses p ∨ r and ¬r ∨ s
◼ Using resolution to conclude: p ∨ s
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 78
1.6 Rules of Inference
Ex 10: Is following argument valid?:
◼ “If you do every problem in this book, then you will learn discrete
mathematics.You learned discrete mathematics”
◼ “Therefore, you did every problem in this book”
Sol:
◼ p: “You did every problem in this book”
◼ q: “You learned discrete mathematics”
◼ The Argument is of form: if p → q and q, then p
◼ Example of incorrect argument using fallacy of affirming conclusion
◼ Indeed, Possible, to learn discrete mathematics in some way other
than by doing every problem in this book
◼ Learn discrete mathematics by reading, listening to lectures, doing
some, but not all, the problems in this book, and so on..
◼ Proposition ((p → q) ∧ ¬p) → ¬q is not a tautology
Because it is false when p is false and q is true
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 80
1.6 Rules of Inference
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 81
1.6 Rules of Inference
Ex: Using rules of inference, construct valid argument to show:
“John Smith has two legs”, Consequence of premises:
“Every man has two legs” and “John Smith is a man”
Sol:
◼ M(x): “x is a man” and L(x): “ x has two legs”
◼ John Smith is member of domain
◼ Valid Argument:
Step Reason
1. x ( M ( x ) → L ( x ) ) Premise
2. M ( J ) → L ( J ) UI from (1)
3. M ( J ) Premise
4. L ( J ) Modus Ponens using ( 2) and ( 3)
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 82
1.6 Rules of Inference
Ex: Construct valid argument showing conclusion:
◼ “Someone who passed the first exam has not read the book”
◼ Follows from premises: “A student in this class has not read the
book” and “Everyone in this class passed the first exam”
Sol: C(x): “x is in this class”, B(x): “ x has read the book”
x ( C ( x ) B ( x ) )
P(x): “x passed the first exam”
◼ Translate premises & conclusion into symbolic form: x ( C ( x ) → P ( x ) )
x ( P ( x ) B ( x ) )
◼ Valid Argument:
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 83
1.6 Rules of Inference
Universal Modus Ponens
◼ Combines universal instantiation
and modus ponens into one rule:
Ex 14: Assume:
1. “For all positive integers n, if n is greater than 4, then n2 is less
than 2n ” is true
2. Use universal modus ponens to show that 1002 < 2100
Sol: P(n): “n > 4” and Q(n): “n2 < 2n”
◼ Statement 1 can be represented : ∀n(P(n) → Q(n))
◼ P(100): True because 100 > 4
◼ It follows by universal modus ponens:
Q(100) is true, namely that 1002 < 2100
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 84
Section Summary
1.6 Rules of Inference
◼ Valid Arguments
◼ Inference Rules for Propositional Logic
◼ Using Rules of Inference to Build Arguments
◼ Rules of Inference for Quantified Statements
◼ Building Arguments for Quantified Statements
Next Section:
◼ 1.7 Introduction to Proofs
Source: "Discrete Mathematics and Its Applications", By Kenneth H. Rosen, 7th Edition 85