You are on page 1of 46

Discrete

Structures/Mathematics
Dr. Qaiser Abbas
Faculty of Computer and Information Systems
Islamic University of Madinah, SA
qabbas@iu.edu.sa

1
CO2: Translate the Predicates and Quantifiers in some different
examples to English sentences or vice versa.

Video Link: https://youtu.be/FHCYyRdE8Mg

2
1.4 Predicates and Quantifiers
• Propositional logic: cannot adequately
express the meaning of all statements in
mathematics and in natural language.

• Predicate logic: can be used to express the


meaning of a wide range of statements that
permit us to reason and explore relationships
between objects.

3
Predicates
• Statements involving variables i.e., “x is greater than 3” has two
parts.
– Variable: x is the subject of the statement
– Predicate: “is greater than 3”, (refers to a property the subject
has).
• Represent “x is greater than 3” by P (x), where P denotes the
predicate “is greater than 3” and x is the variable.

• The statement P (x) is also said to be the value of the propositional


function P at x. Once a value has been assigned to the variable x,
the statement P(x) becomes a proposition.

• We can also have statements that involve more than one variabl,
e.g., “x = y + 3.” We can denote this statement by Q(x, y), where x
and y are variables and Q is the predicate.
4
Predicates
• 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) = F
– A(MATH1, CAMPUS2) = T.

• The P (x1, x2, . . . , xn) is the value of the propositional function P at


the n-tuple (x1, x2, . . . , xn), and P is also called an n-place predicate
or an n-ary predicate.
• Section 1.4: Examples 1 to 3, and Example 5 to 7 (Read it by
yourself)
5
Quantifiers
• Quantification expresses the extent to which a predicate
is true over a range of elements. The words like all, some,
many, none, and few are used in for quantifications.

• We will focus on two types of quantification:


– Universal quantification
– Existential quantification

• Predicate calculus: The area of logic that deals with


predicates and quantifiers.

6
THE UNIVERSAL QUANTIFIER: ∀
• DEFINITION 1
– The universal quantification of P (x) is the
statement “P (x) is true for all values of x in the
domain”
– The notation ∀xP(x) denotes the universal
quantification of P(x) and read as “for all x P(x)” or
“for every x P(x).”

7
THE UNIVERSAL QUANTIFIER: ∀
• 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 x, the
quantification ∀xP(x) is true.
• if the domain is empty, then ∀xP(x) is true for any propositional
function P (x) because there are no elements x in the domain for
which P (x) is false.
• Can be expressed in many other ways, including “all of,” “for each,”
“given any,” “for arbitrary,” “for any”, “for all” and “for every”.
• Avoid using “for any x” because it is often ambiguous as to
whether “any” means “every” or “some.”

8
THE UNIVERSAL QUANTIFIER: ∀
• EXAMPLE
– What is the truth value of ∀xP (x), where P (x) is the
statement “x2 < 10” and the domain consists of the
positive integers not exceeding 4?
– Solution:
– Domain=1,2,3,4
– ∀xP (x) = P(1) ∧ P(2) ∧ P(3) ∧ P(4)
– for P (4), the statement “42 < 10” is false, it follows that
∀xP (x) is false.
• Section 1.4: Example 9, 10, 12 (Read it by yourself)
9
THE UNIVERSAL QUANTIFIER: ∀
• EXAMPLE (Read it by yourself)
– What is the truth value of ∀x(x2 ≥ x) if the domain consists
of all real numbers? What is the truth value of this
statement if the domain consists of all integers?
• Solution:
– If Domain = All real numbers
– For x = 0.5, the statement P(x) = (0.5)2 ≥ 0.5 is false.
– hence P(x) is false for real numbers.
– If Domain = All integers = 0,1,2,3,4,………..
– The statement P(x) = ∀x(x2 ≥ x) is true for all integers as we have not
found any false evidence.

10
THE EXISTENTIAL QUANTIFIER: ∃
• DEFINITION
– The existential quantification of P (x) is the proposition
“There exists at least one element x in the domain
such that P (x) is true for that.”
– We use the notation ∃xP(x) for the existential
quantification of P(x).
• Other ways include “there exists”, “for some,” “for
at least one,” or “there is.”
• ∃xP (x) is read as “There is an x such that P(x)”
“There is at least one x such that P(x),” or
“For some x P(x).”
11
THE EXISTENTIAL QUANTIFIER: ∃
• 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:
– As P(x) = “x > 3”, when x = 4, then ∃xP (x) will become true.

• If the domain is empty, then ∃xQ(x) is false because there is no


element x in the domain for which Q(x) is true.
• For x1, x2, . . . , xn, the statement ∃xP (x) is the disjunction of P(x 1)
∨ P(x2) ∨ ··· ∨ P(xn).

• Section 1.4: Example 15 (Read it by yourself)


12
THE EXISTENTIAL QUANTIFIER: ∃
• EXAMPLE
– What is the truth value of ∃xP(x), where P (x) is
the statement “x2 > 10” and the universe of
discourse consists of the positive integers not
exceeding 4?
– Solution:
– Domain is {1, 2, 3, 4},
– Proposition = ∃xP (x) = P(1) ∨ P(2) ∨ P(3) ∨ P(4).
– For P (4), P(x) is true, it follows that ∃xP (x) is true.

13
Precedence of Quantifiers
• The quantifiers ∀ and ∃ have higher precedence than
all logical operators from propositional calculus.
• For example, ∀xP (x) ∨ Q(x) means (∀xP (x)) ∨ Q(x)
rather than ∀x (P (x) ∨ Q(x)).

• Section 1.4: Example 17 (Read it by yourself)

14
Binding of Quantifier’s Variable
• Bound Variable: When a quantifier is used on
the variable x, this occurrence of the variable
is bound.
• Free Variable: An occurrence of a variable that
is not bound by a quantifier or not set to a
particular value is said to be free.
• Scope of Quantifier: The part of a logical
expression to which a quantifier is applied is
called the scope of this quantifier.
15
Binding of Quantifier’s Variable
• EXAMPLE I
– In the statement ∃x(x + y = 1),
– The variable x is bound by the existential quantification
∃.
– The variable y is free because it is not bound by a
quantifier and no value is assigned to this variable.
• Example II: (Read it Yourself)
– In the statement ∃x(P (x) ∧ Q(x)) ∨ ∀xR(x),
– Binding of ∃x = P (x) ∧ Q(x) and binding of ∀x = R(x). So,
All variables are bound to quantifiers.
– Similarly, the scope of ∃ quantifier = P (x) ∧ Q(x) and the
scope of ∀ quantifier = R(x).
16
Logical Equivalences Involving Quantifiers

• DEFINITION
– Statements involving predicates and quantifiers
are logically equivalent if and only if they have the
same truth value.
– We use the notation S ≡ T to indicate that two
statements S and T involving predicates and
quantifiers are logically equivalent.

17
Logical Equivalences Involving Quantifiers
• EXAMPLE
– Show that ∀x (P (x ) ∧ Q(x )) and ∀x P (x ) ∧ ∀x Q(x ) are logically equivalent
where the same domain is used throughout.

– Solution:
– First, suppose that ∀x(P (x) ∧ Q(x)) is true. This means that if ‘a’ is in the
domain, then P (a) is true and Q(a) is true. we can conclude that ∀xP (x) and
∀xQ(x) are both true, and their conjunction ∀xP (x) ∧ ∀xQ(x) is also true.

– Second, suppose that ∀xP (x) ∧ ∀xQ(x) is true. It follows that ∀xP (x) is true
and ∀xQ(x) is true. Hence, if a is in the domain, then P (a) is true and Q(a) is
true. It follows that for all a, P (a) ∧ Q(a) is true. It follows that ∀x(P (x) ∧ Q(x))
is true.

– We can now conclude that ∀x(P (x) ∧ Q(x)) ≡ ∀xP (x) ∧ ∀xQ(x).
18
Negating Quantified Expressions
• Understanding with example: Consider the negation of the statement
“Every student in your class has taken a course in calculus.”
– P(x) = “x has taken a course in calculus”
– Domain = students in your class.

– Negation = “It is not the case that every student in your class has
taken a course in calculus.”
– Representation = ¬∀xP (x).
– Logical Equivalent = “There is a student in your class who has not
taken a course in calculus.”
– Representation = ∃x¬P(x).

– This example illustrates the logical equivalence: ¬∀xP (x) ≡ ∃x ¬P (x).

19
Negating Quantified Expressions
• Section 1.4: Example 20 (Read it by yourself)

• EXAMPLE
– What are the negations of the statements ∀x(x2 > x) and ∃x(x2 = 2)?
– Solution:
– 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).
– The truth values of these statements depend on the domain.

20
Negating Quantified Expressions
• EXAMPLE
– Show that ¬∀x (P (x ) → Q(x )) and ∃x (P (x ) ∧ ¬Q(x )) are
logically equivalent.

– Solution: By De Morgan’s law for universal quantifiers:


¬∀x(P (x) → Q(x)) = ∃x¬(P (x) → Q(x))

– By the 5th logical equivalence in Table 7 (Section 1.3)


¬(P (x) → Q(x)) = P (x) ∧ ¬Q(x)

– By substituting, ¬∀x(P (x) → Q(x)) = ∃x(P (x) ∧ ¬Q(x)) are


logically equivalent.
21
English into Logical Expressions
• EXAMPLE
– Express the statement “Every student in this class has
studied calculus” using predicates and quantifiers.
– Solution:
– Can rewrite the statement = “For every student in this
class, that student has studied calculus.”
– Introducing a variable x = “For every student x in this
class, x has studied calculus.”
– Predicate C(x) = “x has studied calculus.”
– Applying the quantification = ∀xC(x).
22
English into Logical Expressions
• Other approaches: different domains and predicates can be
used.
• Examples:
– If the domain consist of all people, then rephrasing = “For
every person x, if person x is a student in this class, then x
has studied calculus.”
– If S(x) = person x is in this class, then expression = ∀x(S(x) →
C(x)).
– For two-variable quantifier, the statement = “student x has
studied subject y.”
• Replace C(x) by Q(x, calculus) = ∀xQ(x, calculus) or ∀x(S(x)
→ Q(x, calculus)).
• Section 1.4: Example 24 (Read it by yourself)
23
Using Quantifiers in System Specifications
• EXAMPLE
– Use predicates and quantifiers to express the system specifications “Every mail
message larger than one megabyte will be compressed” and “If a user is active,
at least one network link will be available.”
– Solution:
• Let L(m, y) = “Mail message m is larger than y megabytes,”
• Domain of m = all mail messages
• Domain of y = positive real number
• let C(m) = “Mail message m will be compressed.”
• Then the specification = ∀m(L(m, 1) → C(m)).

• Let A(u) = “User u is active,”


• Domain of u = all users,
• let S (n, x ) = “Network link n is in state x ,”
• Domain of n = all network links
• Domain of x = all possible states for a network link e.g available or unavailable.
• Then the specification = ∃uA(u) → ∃nS(n, available).
24
Nested Quantifiers: Logical Expression into
English
• EXAMPLE
– Translate into English the statement ∀x∀y((x > 0)∧(y
< 0) → (xy < 0)), where the domain for both variables
consists of all real numbers.
– Solution:
• Statement = “For all real numbers x and y, if x is positive
and y is negative, then xy is negative”
• Statement also = “The product of a positive real number
and a negative real number is always a negative real
number.”
• Section 1.5: Examples 3 to 5 (Read it by yourself)
25
Nested Quantifiers

26
Nested Quantifiers
• EXAMPLE: Express the statement “Everyone has exactly one best friend” as a
logical expression involving predicates, quantifiers with a domain consisting
of all people, and logical connectives.
• Solution:
– Rephrased = “For every person x, person x has exactly one best friend.”
– Let B(x, y) = “y is the best friend of x,”
– To represent the concept of “exactly one best friend” means that there is a person y
who is the best friend of x, and for every person z, if person z is not person y, then z
is not the best friend of x.
– Then statement = ∃y(B(x, y) ∧ ∀z((z ̸= y) → ¬B(x, z))).

– The final statement = ∀x∃y(B(x, y) ∧ ∀z((z ̸= y) → ¬B(x, z))).

• [Rewritten = ∀x∃!yB(x, y), where ∃! is the “uniqueness quantifier”]

• Section 1.5: Example 6 to 13 (Read it by yourself)


27
Nested Quantifiers
• EXAMPLE: Express the negation of the statement
∀x∃y(xy = 1) so that no negation precedes a quantifier.
• Solution:
– By successively applying De Morgan’s laws for quantifiers in
Table 2 of Section 1.4.
= ¬∀x∃y(xy = 1)
= ∃x¬∃y(xy = 1)
= ∃x∀y¬(xy = 1)
= ∃x∀y(xy ̸= 1)

Section 1.5: Examples 15 to 16 (Read it by yourself)


28
Examples from Lewis Carroll
(Read it Yourself)
• Example: Consider these statements. The first two are called premises
(propositions) and the third is called the conclusion. The entire set is
called an argument.
– “All lions are fierce.”
– “Some lions do not drink coffee.”
– “Some fierce creatures do not drink coffee.”
• Solution:
– Let L (x)= “x is a lion”
– F(x) = “x is fierce” and
– C(x) = “x drinks coffee”
– Domain = all creatures
– Then ∀x(L(x) → F(x)), ∃x(L(x) ∧ ¬C(x)), ∃x(F(x) ∧ ¬C(x)).

• Section 1.4: Example 27 (Read it by yourself)


29
Rules of Inference
• Argument form: is a sequence of compound propositions
involving propositional variables.
• Valid argument form: when the conclusion is true if the
premises are all true.
– (p1 ∧ p2 ∧ · · · ∧ pn) → q is a tautology.
• The tautology (p ∧ (p → q)) → q is the basis of the rule of
inference called modus ponens, or the law of detachment.

• Modus ponens tells us that if a conditional statement and


the hypothesis are both true, then the conclusion must also
be true.
30
Rules of Inference
• EXAMPLE: Suppose that the conditional statement “If it snows today, then
we will go skiing” and its hypothesis, “It is snowing today,” are true. Then,
by modus ponens, the conclusion of the conditional statement, “We will
go skiing,” is true.

• Note: A valid argument can lead to an incorrect conclusion if one or more


of its premises is false.
• EXAMPLE: (i). Determine whether the argument given is valid and (ii). determine
whether its conclusion must be true because of the validity of the argument.
– “If √2 > 3/2, then (√2)2 > (3/2)2. We know that √2 > 3/2. Consequently, (√ 2)2 = 2 > (3/2)2 = 9/4 ”
• Solution:
– Let p = “√2 > 3/2” and q = “2 > (3/2)2.” , then
– Premises = p → q and p, and conclusion = q.
– (i). Argument is valid as constructed using modus ponens.
– (ii). However, √2 > 3/2 = false. Consequently, the conclusion = false as 2 < 9/4 .

31
Rules of Inference
• EXAMPLE: State which rule of
inference is the basis of the
following argument: “It is below
freezing now. Therefore, it is
either below freezing or raining
now.”
• Solution:
– Let p = “It is below freezing now”
and q = “It is raining now.” Then
– Argument form used = p(p v q)
and it is called addition rule.

• Section 1.6: Example 4(Read it


by yourself)
32
Rules of Inference
• EXAMPLE: State which rule of inference is used in the argument:
“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”.
• Solution:
– Let p = “It is raining today,”
– let q = “We will not have a barbecue today,” and
– let r = “We will have a barbecue tomorrow.”
– Then this argument is of the form

– Which is a hypothetical syllogism according to the table

33
Rules of Inference
• EXAMPLE: Show that the 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,” and “If we take
a canoe trip, then we will be home by sunset” lead to the conclusion
“We will be home by sunset.”
• Solution: Suppose
– 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”

• Section 1.6: EXAMPLE 7 (READ IT YOURSELF)


34
Rules of Inference
– EXAMPLE: 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.”
– Solution:
• Let p = “It is snowing,”
• q = “Jasmine is skiing,”
• and r = “Bart is playing hockey.”
• Hypotheses = ¬p ∨ q and p ∨ r

• Using resolution, the q ∨ r = “Jasmine is skiing, or Bart is playing


hockey”.

35
Proofs by Rule of Inference
• Clause: is a disjunction of variables or
negations of these variables.
– we can replace the statement p ∨ (q ∧ r) by two
statements p ∨ q and p ∨ r, each of which is a
clause.
– Replace a statement of the form ¬(p ∨ q) by the
two statements ¬p and ¬q (De Morgan’s law)
– Replace a conditional statement p → q with the
equivalent disjunction ¬p ∨ q.

36
Proofs by Rule of Inference
• EXAMPLE
– Show that the premises (p ∧ q) ∨ r and r → s imply the
conclusion p ∨ s.
– Solution:
• Rewrite the premises (p ∧ q) ∨ r as two clauses, p ∨ r and q ∨
r. (Distributive Law: Table 6)
• Replace r → s by the equivalent clause ¬r ∨ s. (1 st Law: Table 7)
• Using the two clauses p ∨ r and ¬r ∨ s, we can use resolution
to conclude p ∨ s.

• Section 1.6: Examples 10 to 11 (Read it by yourself)


37
Rules of Inference for Quantified
Statements
• Universal instantiation: A rule of inference used to
conclude that P (c) is true, given the premise ∀xP (x)
where c is a particular member of the domain.

• Used when we conclude from the statement “All


women are wise” therefore “Lisa is wise,” where Lisa
is a member of the domain of all women.

38
Rules of Inference for Quantified
Statements
• Universal Generalization: We show that ∀xP (x) is
true by taking an arbitrary element c from the
domain and showing that P (c) is true.

39
Rules of Inference for Quantified
Statements
• Existential instantiation: If we know that ∃xP(x) is
true, then there is an element c (not arbitrary) from
the domain for which P (c) is true.

40
Rules of Inference for Quantified
Statements
• Existential generalization: If we know one
element c (not arbitrary) in the domain for
which P (c) is true, then we know that ∃xP (x)
is true.

41
Rules of Inference for Quantified
Statements
• EXAMPLE
Show that the premises “Everyone in this discrete mathematics class has taken a course in computer
science” and “Marla is a student in this class” imply the conclusion “Marla has taken a course in computer
science.”
• Solution:
D(x) = “x is in this discrete mathematics class,” and
C(x) = “x has taken a course in computer science.”
Premises = ∀x(D(x) → C(x)) and D(Marla).
Conclusion = C(Marla).

The following steps can be used to establish the conclusion from the premises.

Section 1.6: EXAMPLE 13 (Read it yourself)

42
Combining Rules of Inference for
Propositions and Quantified Statements
• Universal Modus Ponens. This is the combination of
Universal instantiation and modus ponens which are
used so often.

• if ∀x(P (x) → Q(x)) is true, and if P (a) is true for a


particular element a in the domain of the universal
quantifier, then Q(a) must also be true.

43
Combining Rules of Inference for
Propositions and Quantified Statements
• EXAMPLE
Assume that “For all positive integers n, if n is greater than 4,
then n2 is less than 2n” is true. Use universal modus ponens
to show that 1002 < 2100.
• Solution:
Let G(n) = “n > 4” and L(n) = “n2 < 2n.”
Statement = ∀n(G (n) → L(n))
Domain = all positive integers.
Assume ∀n(G (n) → L(n)) = true.
Then for particular element a = 100, G (100) = true as 100 > 4.
L(100) = 1002 < 2100 = true by Universal Modus Penens

44
Combining Rules of Inference for
Propositions and Quantified Statements
• Universal modus tollens combines universal
instantiation and modus tollens and can be
expressed in the following way:

• if ∀x(P (x) → Q(x)) is true, and if Q(a) is false for a


particular element a in the domain of the universal
quantifier, then P(a) must also be false.
45
Quiz # 1
• Be ready for the Quiz in next week. Insha Allah

46

You might also like