0% found this document useful (0 votes)
19 views

Lecture#4 DS Fall24

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lecture#4 DS Fall24

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

(GE120)

DISCRETE STRUCTURES

LECTURE # 4

Predicate Logic and Methods of Proofs

By,
Dr. Mehwish Manzur
NUTECH
Layout of Today’s Lecture

• Laws of Logic
• Predicates and Quantifiers
• Methods of Proving Theorems
• Introduction to Sets
PREDICATES

Statements involving variables, such as “x > 3,” “x = y + 3,” “x + y = z,” and “computer x is
under attack by an intruder,” And “computer x is functioning properly,” are often found in
mathematical assertions, in computer programs, and in system specifications. These
statements are neither true nor false when the values of the variables are not specified.
“x is greater than 3” has two parts. The variable x, is
the subject of the statement. The second part the
predicate, “is greater than 3”

• We can denote the statement “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
and has a truth value.
EXAMPLE
Let P(x) denote the statement “x > 3.” What are the truth values of P(4)
and P(2)?

Solution:
We obtain the statement P(4) by setting x = 4 in the statement “x > 3.”
Hence P(4), which is the statement “4 > 3,” is true.
However, P(2), which is the statement “2 > 3,” is false.
EXAMPLE
Let A(x) denote the statement “Computer x is under attack by an intruder”
Suppose that of the computers on campus, only CS2 and MATH1 are currently
under attack by intruders. What are truth values of A(CS1), A(CS2), and
A(MATH1)?
Solution:

We obtain the statement A(CS1) by setting x = CS1 in the statement


“Computer x is under attack by an intruder” Because CS1 is not on the list of
computers currently under attack, we conclude that A(CS1) is false.
Similarly, because CS2 and MATH1 are on the list of computers under attack,
we know that A(CS2) and A(MATH1) are true.
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:
To obtain Q(1, 2), set x = 1 and y = 2 in the statement Q(x, y). Hence, Q(1, 2) is
the statement “1 = 2 + 3” which is false.
The statement Q(3, 0) is the proposition “3 = 0 + 3” which is true.
QUANTIFIERS

Quantification expresses the extent to which a predicate is true over a range of


elements. In English, the words all, some, many, none, and few are used in quantifications.
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).
Note:

Besides “for all” and “for every,” universal quantification can be expressed

in many other ways, including “all of,” “for each,” “given any,” “for arbitrary,”

“for each,” and “for any.”


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.
EXAMPLE

Suppose that P(x) is “𝑥 2 > 0.” To show that the statement ∀xP(x) is false
where the universe of discourse consists of all integers,
We give a counterexample.We see that x = 0 is a counterexample because
𝑥 2 = 0 when x = 0, so 𝑥 2 is not greater than 0 when x = 0.
EXISTENTIAL QUANTIFICATION

The existential quantification of P(x) is the proposition


“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.
EXAMPLE
Let P(x) denote the statement “x > 3.” What is the truth?
Solution:
Because “x > 3” is sometimes true for instance, when x = 4, the
existential quantification of P(x), which is ∃xP(x), is true.

Note:

Observe that the statement ∃xP(x) is false if and only if there is no


element x in the domain for which P(x) is true.
That is, ∃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 truth value of
the quantification ∃xQ(x). where the domain consists of all real
numbers?
Solution:
Because Q(x) is false for every real number x, the existential
quantification of Q(x),
which is ∃xQ(x), is false.
EXAMPLE

Express the statement “Every student in this class has studied calculus” using
predicates and quantifiers.

Solution:

First, we rewrite the statement so that we can clearly identify the appropriate
quantifiers to use. Doing so, we obtain:

“For every student in this class, that student has studied calculus”

Next, we introduce a variable x so that our statement becomes

“For every student x in this class, x has studied calculus”


EXAMPLE

Express the statements “Some student in this class has visited Mexico” using
predicates and quantifiers.

Solution:

The statement “Some student in this class has visited Mexico” means that

“There is a student in this class with the property that the student has visited
Mexico”

We can introduce a variable x, so that our statement becomes

“There is a student x in this class having the property that x has visited Mexico”
INTRODUCTION TO PROOFS

 Theorem is a statement that can be shown to be true. In


mathematical writing, the term theorem is usually reserved for a
statement that is considered at least somewhat important.
 Less important theorems sometimes are called propositions.
 A proof is a valid argument that establishes the truth of a theorem.
The statements used in a proof can include axioms (or postulates)
 A less important theorem that is helpful in the proof of other results
is called a lemma.
 A corollary is a theorem that can be established directly from a
theorem that has been proved.
 To prove a theorem of the form ∀x(P (x) → Q(x)), our goal is to show that P (c) → Q(c)
is true, where c is an arbitrary element of the domain, and then apply universal generalization.
 In the proof, we need to show that a conditional statement is true.
 Recall that p → q is true unless p is true but q is false. Note that to prove the statement p → q, we need
only show that q is true if p is true.
METHODS OF PROVING THEOREMS

Direct Proof

A direct proof of a conditional statement p → q is constructed when the first step is


the assumption that p is true; subsequent steps are constructed using rules, with the final
step showing that q must also be true. A direct proof shows that a conditional statement

p → q is true by showing that if p is true, then q must also be true, so that the
combination p true and q false never occurs.
EXAMPLE
Give a direct proof of the theorem “If n is an odd integer, then 𝑛2 is odd”
Solution:
Note that this theorem states ∀nP ((n) → Q(n)), where P(n) is “n is an odd integer” and Q(n)
is “𝑛2 is odd”
By the definition of an odd integer, it follows that n = 2k + 1. We want to show that 𝑛2 is
also odd. We can square both sides of the equation n = 2k + 1 to obtain a new equation
that expresses 𝑛2 .When we do this, we find that
𝑛2 = (2k + 1) 2 = 4𝑘 2 + 4𝑘 + 1 = 2(2𝑘 2 + 2𝑘) + 1 . By the definition of an odd
integer, we can conclude that 𝑛2 is an odd integer (it is one more than twice an integer).
Consequently, we have proved that if n is an odd integer, then 𝑛2 is an odd integer.
Hint Definition
The integer n is even if there exists an integer k such that
n = 2k, and n is odd 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.)
EXAMPLE
Give a direct proof that “If m and n are both perfect squares, then mn is also a perfect square”
Solution:
• We assume that 𝑚 and 𝑛 are both perfect squares. By the definition of a perfect square,
it follows that there are integers s and t such that 𝑚 = 𝑠 2 and 𝑛 = 𝑡 2 .
• The goal of the proof is to show that mn must also be a perfect square when 𝑚 and 𝑛
are; looking ahead we see how we can show this by substituting 𝑠 2 for 𝑚 and 𝑡 2 for 𝑛
into 𝑚𝑛. This tells us that 𝑚𝑛 = 𝑠 2 𝑡 2 .
• Hence, 𝑚𝑛 = 𝑠 2 𝑡 2 = (𝑠𝑠)(𝑡𝑡) = (𝑠𝑡)(𝑠𝑡) = (𝑠𝑡)2 , using commutativity and
associativity of multiplication.
• By the definition of perfect square, it follows that 𝑚𝑛 is also a perfect square, because it
is the square of 𝑠𝑡, which is an integer. Hint
Definition
An integer a is a perfect square if there is an integer b
such that a = 𝑏2
Indirect Proof
Proof by Contraposition

1. Express the statement to be proved in the form


∀x in D, if P(x) then Q(x).
2. Rewrite this statement in the contra positive form
∀x in D, if Q(x) is false then P(x) is false.
3. Prove the contra-positive by a direct proof.
a. Suppose x is a (particular but arbitrarily chosen)
element of D such that Q(x) is false (or ¬Q(x) is true).
b. Show that P(x) is false (or ¬P(x) is true).
Proof by Contra-positive

 Proofs by contraposition make use of the fact that:

The conditional statement p → q is equivalent to its contrapositive, ¬q → ¬p.

 This means that the conditional statement p → q can be proved by showing

that its contrapositive, ¬q → ¬p, is true.


Proof by Contraposition
Proposition:
For all integers n, if n2 is even then n is even.
Contra positive:
For all integers n, if n is not even then n2 is not even.
Proof:
Suppose n is any odd integer. [We must show that n2 is
odd.] By definition of odd, n = 2k + 1 for some integer k. By
substitution and algebra,
n2 = (2k+1)2 = 4 k2 + 4k + 1 = 2(2 k2 + 2k) + 1.
But 2k2 + 2k is an integer because products and sums of
integers are integers. So n2 = 2·(an integer) + 1, and thus,
by definition of odd, n2 is odd.
SETS

A set is an unordered collection of objects, called elements


or members of the set. A set is said to contain its elements.
We write a ∈ A to denote that a is an element of the set A.
The notation a ∉ A denotes that a is not an element of the
set A.
Sets are conventionally denoted with capital letters.
Note: A set should be well defined and distinct.
Examples
 A =A= {tiger, lion, puma, cheetah, leopard, cougar,
ocelot} (this is a set of large species of cats).
 A = {a, b, c, ..., z} (this is a set consisting of the
lowercase letters of the alphabet)
 A = {-1, -2, -3, ...} (this is a set of the negative numbers)

In all above examples each element of the sets is distinct


and well defined.
Open and Closed Intervals
[a, b] = {x | a ≤ x ≤ b} [a, b) = {x | a ≤ x < b}
(a, b] = {x |a < x ≤ b} (a, b) = {x |a < x < b}

Note that [a, b] is called the closed interval from a to b and (a, b)
is called the open interval from a to b.
Equal Sets
Two sets are equal if and only if they have the same elements.
Therefore, if A and B are sets, then
A and B are equal if and only if ∀x(x ∈ A ↔ x ∈ B)
We write A = B if A and B are equal sets.
EMPTY SET AND SINGLETON SET

There are some sets which hold great mathematical importance and are
referred to with such regularity that they have acquired special names and
notational conventions to identify them. One of these is the empty set,
denoted { } or ∅. Another is the singleton set {x} which contains exactly
one element, namely x.
SPECIAL SETS

• P or ℙ, denoting the set of all primes P = {2, 3, 5, 7,11, 13, 17, ...}
• N or ℕ, denoting the set of all natural numbers: N = {1, 2, 3, . . .}
• Z or ℤ, denoting the set of all integers (whether positive, negative
or zero): Z = {..., −2, −1, 0, 1, 2, ...}.
• Q or ℚ, Q = {a/b : a, b ∈ Z, b ≠ 0}. For example, 1/4 ∈ Q and 11/6 ∈
Q.
• R or ℝ, denoting the set of all real numbers. This set includes all
rational numbers, together with all irrational numbers (that is,
numbers which cannot be rewritten as fractions, such as π, e, and
√2, as well as numbers that cannot be defined).
• C or ℂ, denoting the set of all complex numbers : C = {a + bi : a, b ∈
R}. For example, 1 + 2i ∈ C.
Finite Set:
A set is finite if it contains a specific (finite) number of elements, i.e.,
If we can count the element in a set, such sets are called finite sets.

• Example: Some finite numbers in a set: the number of students in


your class, the number of seats on a bus, and the number of
people on earth.
Infinite Set:
If we can not count the elements in a set such sets are called infinite
sets.

• Example: Set of Natural numbers, Set of Whole numbers.


Cardinality of Sets

Let S be a set. If there are exactly n distinct elements in S


where n is a nonnegative integer, we say that S is a finite set
and that n is the cardinality of S. The cardinality of S is
denoted by |S|.

Cardinality refers to the number of elements in a set.


Finite and Infinite Set Cardinality
Set Definition Cardinality

A = {x | x is a lower case letter} |A| = 26

B = {2, 3, 4, 5, 6, 7} |B| = 6

C = {x | x is an even number  10} |C|= 4

A = {1, 2, 3, …} |A| = ∞

B = {x | x is a point on a line} |B| = ∞

C = {x| x is a point in a plane} |C| = ∞


Membership of Sets

The key relation between sets is membership when one set is an


element of another. If a is a member of B, this is denoted a ∈ B, while
if c is not a member of B then c ∉ B. For example, With respect to the
sets A = {1,2,3,4} and B = {blue, white, red}, 4 ∈ A and green ∉ B.
Universal Sets:
The universal set is the set of all things relevant to a given discussion
and is designated by the symbol U. i.e. it contains every set.

Subsets Sets:
The set A is a subset of B if and only if every element of A is also an
element of B. We use the notation A ⊆ B to indicate that A is a
subset of the set B.
The quantification of A ⊆ B is ∀x(x ∈ A → x ∈ B).
Note:

Showing that A is a Subset of B


To show that A ⊆ B, show that if x belongs to A then x also
belongs to B.
Showing that A is Not a Subset of B
To show that A ⊆ B, find a single x ∈ A such that x ∉ B.
Super Set:
If we can write B ⊇ A, read as B is a superset of A, B includes A, or
B contains A.
Proper Subset:
If A is a subset of, but not equal to, B, then A is called a proper
subset of B, written A ⊂ B (A is a proper subset of B) or B ⊃ A (B is
a proper superset of A).

Examples
• The set of all men is a proper subset of the set of all people.
• {1, 3} ⊂ {1, 2, 3, 4}.
• {1, 2, 3, 4} ⊆ {1, 2, 3, 4}.
Theorem:

For every set S,

 ∅ ⊆ S and

 S ⊆ S.
An obvious but useful identity, which can often be used to
show that two seemingly different sets are equal:
A = B if and only if A ⊆ B and B ⊆ A.
Subset Relationships
A = {x | x is a positive integer  8}
set A contains: 1, 2, 3, 4, 5, 6, 7, 8
B = {x | x is a positive even integer  10}
set B contains: 2, 4, 6, 8
C = {2, 4, 6, 8, 10}
set C contains: 2, 4, 6, 8, 10
The universal set U = {1,2,3,4,5,6,7,8,9,10}.

Subset Relationships
AA AB AC
BA BB BC
CA CB CC
Set Equality
Two sets are equal if and only if they contain precisely the same
elements.
The order in which the elements are listed is un important.
Elements may be repeated in set definitions without increasing the
size of the sets.
Examples
 A = {1, 2, 3, 4} B = {1, 4, 2, 3}
A  B and B  A; therefore, A = B and B = A.
 A = {1, 2, 2, 3, 4, 1, 2} B = {1, 2, 3, 4}
A  B and B  A; therefore, A = B and B = A.
Notations
Symbol Meaning
Upper case designates set name
Lower case designates set elements
{ } enclose elements in set
 (or ∉ ) is (or is not) an element of
 is a subset of (includes equal sets)
 is a proper subset of
 is not a subset of
 is a superset of
| or : such that (if a condition is true)
| | the cardinality of a set
Venn Diagrams
Venn diagrams or set diagrams are diagrams that show all
possible logical relations between a finite collection of sets. Venn
diagrams were conceived around 1880 by John Venn.
Venn diagrams show relationships between sets and their
elements.
Sets A & B

Universal Set
Examples
Set Definition Elements
A = {x | x  Z+ and x  8} {1, 2 ,3, 4, 5, 6 ,7, 8}
B = {x | x  Z+, x is even and  10} {2, 4, 6, 8, 10}

AB
BA
Cont…
Set Definition Elements
A = {x | x  Z+ and x  9} {1, 2 ,3, 4, 5, 6 ,7, 8,9}
B = {x | x  Z+ ; x is even and  8} {2, 4, 6, 8,}

AB
BA
AB

You might also like