1
DISCRETE MATHEMATICS
MATH301
Chapter 1: The Foundations: Logic and
Proofs
Dr. Nahid Sultana
Email: nszakir@[Link]
Copyright © Nahid Sultana, 2016-2017.
3/1/2023
1.2 Applications of Propositional Logic
2
Translating English Sentences
Steps to convert an English sentence to a statement in
propositional logic
1. Identify propositions and represent using propositional
variables.
2. Determine appropriate logical connectives.
Example: “If I go to school or to the hospital, I will not go
shopping.” If p or q then not r.
p: I go to school
q: I go to the hospital
r: I will go shopping
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Example
3
Problem: Translate the following sentence into
propositional logic:
“You can access the Internet from campus only if you are a
computer science major or you are not a freshman.”
Solution:
a=“You can access the internet from campus,”
c=“You are a computer science major,”
f=“You are a freshman.”
a→ (c ∨ ¬ f )
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
1.3 Propositional Equivalences
4
Tautologies, Contradictions, and Contingencies.
Logical Equivalence
Important Logical Equivalences
Showing Logical Equivalence
Propositional Satisfiability
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Tautologies, Contradictions, and
Contingencies
5
A compound proposition that is always true for all possible combination
of truth values of the propositional variables is called a tautology.
Example: p ∨¬p
A compound proposition that is always false for all possible combination
of truth values of the propositional variables is called a contradiction.
Example: p ∧¬p
A contingency is a proposition which is neither a tautology nor a
contradiction, such as p
P ¬p p ∨¬p p ∧¬p
T F T F
F T T F
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Logical Equivalence
6
Two propositions are logically equivalent if they always have the
same truth value.
Two compound propositions p and q are logically equivalent if p↔q
is a tautology.
Example: Show using a truth table that the conditional is equivalent
to the contrapositive.
p q p →q ~q ~p ~q → ~p
T T T F F T
T F F T F F
F T T F T T
F F T T T T
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Logical Equivalence
7
Example: Show using truth tables that the converse and inverse of an
implication are not equivalent to the implication.
p q Implication Converse ~p ~q Inverse
p →q q→p ~p→~q
T T T T F F T
T F F T F T T
F T T F T F F
F F T T T T T
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
De Morgan’s Laws
8
This truth table shows that De Morgan’s Second Law holds.
p q ¬p ¬q (p∨q) ¬(p∨q) ¬p∧¬q
T T F F T F F
T F F T T F F
F T T F T F F
F F T T F T T
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Key Logical Equivalences
9
Identity Laws: ,
Domination Laws: ,
Idempotent laws: ,
Double Negation Law:
Negation Laws: ,
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Key Logical Equivalences (cont)
10
Commutative Laws: ,
Associative Laws:
Distributive Laws:
Absorption Laws: ,
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
More Logical Equivalences
11
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Propositional Satisfiability
12
A compound proposition is satisfiable if there is an
assignment of truth values to its variables that make
it true.
Such an assignment is called a solution of this
particular satisfiability problem.
When no such assignments exist, the compound
proposition is unsatisfiable.
A compound proposition is unsatisfiable if and only
if its negation is a tautology.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Propositional Satisfiability (cont.)
13
Example: Determine the satisfiability of the following compound propositions:
Solution: Satisfiable. Assign T to p, q, and r.
Solution: Satisfiable. Assign T to p and F to q.
Solution: Not satisfiable. Check each possible assignment of truth values to
the propositional variables and none will make the proposition true.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
1.4 Predicates and Quantifiers
14
Predicates
Variables
Quantifiers
Universal Quantifier
Existential Quantifier
Negating Quantifiers
De Morgan’s Laws for Quantifiers
Translating English to Logic
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Introducing Predicate Logic
15
Predicate logic uses the following new features:
Variables: x, y, z
Predicates: P(x), M(x)
Quantifiers (to be covered in a few slides):
Propositional functions are a generalization of
propositions.
They contain variables and a predicate, e.g., P(x)
Variables can be replaced by elements from their
domain.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Propositional Functions
16
Suppose p(x): “x > 3” is an open statement (propositional
function).
When a value has been assigned to the variable x, the
propositional function p(x) becomes a proposition and has a truth
value (either true or false). As x varies the truth values of p(x) varies.
Example: Suppose p(x): x >3. What are the truth values of p(2)
and p(4).
We can also have statement involve more than one variable. For
example consider the statement p(x, y): x=y+3.
Example: Suppose p(x, y): x=y+3. What are the truth values of
16
p(1,2) and p(3,0). Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Examples of Propositional Functions
17
Let “x + y = z” be denoted by R(x, y, z) and the domain U (for all three variables)
be the integers. Find these truth values:
R(2,-1,5)
Solution: F
R(3,4,7)
Solution: T
R(x, 3, z)
Solution: Not a Proposition
Now let “x - y = z” be denoted by Q(x, y, z), with U as the integers. Find these truth
values:
Q(2,-1,3)
Solution: T
Q(3,4,7)
Solution: F
Q(x, 3, z)
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Solution: Not a Proposition
Quantifiers
18
We need quantifiers to express the meaning of English words
including all and some:
“All men are Mortal.”
“Some students do not use cell phone.”
The two most important quantifiers are:
Universal Quantifier, “For all,” symbol:
Existential Quantifier, “There exists,” symbol:
We write as in x P(x) and x P(x).
x P(x) asserts P(x) is true for every x in the domain.
x P(x) asserts P(x) is true for some x in the domain.
The quantifiers are said to bind the variable x in these expressions.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Quantifier (cont…)
19
x P(x) is read as “For all x, P(x)” or “For every x, P(x)”
Examples:
1) If P(x) denotes “x > 0” and U is the integers, then x P(x) is
false.
2) If P(x) denotes “x > 0” and U is the positive integers, then
x P(x) is true.
3) If P(x) denotes “x is even” and U is the integers, then x P(x)
is false.
19
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Quantifier (cont…)
20
x P(x) is read as “For some x, P(x)”, or as “There is an x such that
P(x),” or “For at least one x, P(x).”
Examples:
1. If P(x) denotes “x > 0” and U is the integers, then x P(x)
is true. It is also true if U is the positive integers.
2. If P(x) denotes “x < 0” and U is the positive integers, then
x P(x) is false.
3. If P(x) denotes “x is even” and U is the integers, then x
P(x) is true.
20
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Quantifier (cont…)
21
21
Thinking about Quantifiers
24
22
When the domain of discourse is finite, we can think of
quantification as looping through the elements of the domain.
To evaluate x P(x) loop through all x in the domain.
If at every step P(x) is true, then x P(x) is true.
If at a step P(x) is false, then x P(x) is false and the loop terminates.
To evaluate x P(x) loop through all x in the domain.
If at some step, P(x) is true, then x P(x) is true and the loop
terminates.
If the loop ends without finding an x for which P(x) is true, then x P(x)
is false.
Even if the domains are infinite, we can still think of the quantifiers
in this fashion, but the loops will not terminate in some cases.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Properties of Quantifiers
23
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:
If U is the positive integers and P(x) is the statement “x < 2”, then
x P(x) is true, but x P(x) is false.
If U is the negative integers and P(x) is the statement “x < 2”, then
both x P(x) and x P(x) are true.
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.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Precedence of Quantifiers
24
The quantifiers and have higher precedence than all the
logical operators.
For example, x P(x) ∨ Q(x) means (x 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)).
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Translating from English to Logic
25
Example 1: Translate the following sentence into predicate logic: “Every
student in this class has taken a course in Java.”
Solution:
First decide on the domain U.
Solution 1: -If U is all students in this class,
-define J(x) denoting “x has taken a course in Java”
-translate as x J(x).
Solution 2: -But if U is all people,
-define S(x) denoting “x is a student in this class”
“For every person x, if person x is a student in this class then x has taken a course in
Java.”
-translate asx (S(x)→ J(x)).
x (S(x) ∧ J(x))
is not correct. --all people are students in this class and have taken a course in Java.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Translating from English to Logic
26
Example 2: Translate the following sentence into predicate logic:
“Some student in this class has taken a course in Java.”
Solution:
First decide on the domain U.
Solution 1: If U is all students in this class,
--translate as x J(x)
Solution 2: But if U is all people,
“there is a person x who is a student in this class and who has taken Java.”
--then translate as x (S(x) ∧ J(x))
x (S(x)→ J(x))
--is not correct. –is true when there is someone not in the class
--because, in that case, for such a person x, S(x) → J(x) becomes either F→T
or F→F, both of which are true.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Equivalences in Predicate Logic
27
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 in the
expressions.
The notation S ≡T indicates that S and T are logically equivalent.
Example: x ¬¬S(x) ≡ x S(x)
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Thinking about Quantifiers as
Conjunctions and Disjunctions
28
If the domain is finite, a universally quantified proposition is equivalent to a
conjunction of propositions without quantifiers and an existentially quantified
proposition is equivalent to a disjunction of propositions without quantifiers.
If U consists of the integers 1,2, and 3:
Even if the domains are infinite, you can still think of the quantifiers in this fashion,
but the equivalent expressions without quantifiers will be infinitely long.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Negating Quantified Expressions
29
Consider with p(x): “x is a female”
and D=student in this class
“All students in this class are female”
Negation:
“It is not the case that all students in this class are female.”
This implies that
“There is a student in this class who is not female.”
------This is a existential quantification of the negation of p(x).
Theorem:
Analogous Theorem:
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Negating Quantified Expressions
(Cont…)
30
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Translation from English to Logic
31
Examples:
1. “Some student in this class has visited Mexico.”
Solution: Let M(x): “x has visited Mexico”
and S(x): “x is a student in this class,”
and U be all people.
x (S(x) ∧ M(x))
2. “Every student in this class has visited Canada or Mexico.”
Solution: Add C(x): “x has visited Canada.”
x (S(x)→ (M(x)∨C(x)))
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Arguments
32
Definition: A logical argument is a finite set of propositions
(premises or hypothesis) followed by a proposition (conclusion).
Denoted by:
Suppose the premises are all true, then conclusion may be either
true or false.
When the conclusion is true then the argument is said to be valid.
When the conclusion is false then the argument is said to be invalid
32
or fallacy. Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Arguments (cont…)
33
Show that the argument is valid.
Show that the argument is invalid.
Show that the argument is valid.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023 33
1.5 Nested Quantifiers
34
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.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Nested Quantifiers
35
Nested quantifiers are often necessary to express the meaning of
sentences in English as well as important concepts in computer science
and mathematics.
Example: “Every real number has an inverse” is
x y(x + y = 0)
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): y P(x, y), where P(x, y) is (x + y = 0)
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Order of Quantifiers
36
Examples:
Let P(x,y) be the statement “x + y = y + x.”
Assume that U is the real numbers.
Then x yP(x,y) andy xP(x,y) have the same truth value.
Let Q(x,y) be the statement “x + y = 0.”
Assume that U is the real numbers.
Then x yP(x,y) is true, but y xP(x,y) is false.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Questions on Order of Quantifiers
37
Example 1: Let U be the real numbers,
Define P(x,y) : x ∙ y = 0
What is the truth value of the following:
1. xyP(x,y)
Answer: False
2. xyP(x,y)
Answer: True
3. xy P(x,y)
Answer: True
4. x y P(x,y)
Answer: True
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Questions on Order of Quantifiers
38
Example 2: Let U be the real numbers,
Define P(x,y) : x / y = 1
What is the truth value of the following:
1. xyP(x,y)
Answer: False
2. xyP(x,y)
Answer: True
3. xy P(x,y)
Answer: False
4. x y P(x,y)
Answer: True
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Quantifications of Two Variables
39
Statement When True? When False
P(x,y) is true for every pair There is a pair x, y for
x,y. which P(x,y) is false.
For every x there is a y for There is an x such that
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 for
P(x,y) is true for every y. 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
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Translating Nested Quantifiers into
40
English
Example 1: Translate the statement
x (C(x )∨ y (C(y ) ∧ F(x, y)))
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.
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Translating Mathematical Statements
41
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.”
3. The result is:
x y ((x > 0)∧ (y > 0)→ (x + y > 0))
where the domain of both variables consists of all integers
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Translating English into Logical
42
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.
3. Then the statement can be expressed as:
w a f (P(w,f ) ∧ Q(f,a))
Copyright © Nahid Sultana, 2016-2017. 3/1/2023
Questions on Translation from English
Choose the obvious predicates and express in predicate logic.
Example 1: “Brothers are siblings.”
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.”
Solution: x y L(x,y)
Example 4: “There is someone who is loved by everyone.”
Solution: y x L(x,y)
Example 5: “There is someone who loves someone.”
Solution: x y L(x,y)
Example 6: “Everyone loves himself”
Solution: x L(x,x)
Negating Nested Quantifiers
Example 1: Recall the logical expression developed three slides back:
w a f (P(w,f ) ∧ Q(f,a))
Part 1: Use quantifiers to express the statement that “There does not exist a woman who has
taken a flight on every airline in the world.”
Solution: ¬w a f (P(w,f ) ∧ Q(f,a))
Part 2: Now use De Morgan’s Laws to move the negation as far inwards as possible.
Solution:
1. ¬w a f (P(w,f ) ∧ Q(f,a))
2. w ¬ a f (P(w,f ) ∧ Q(f,a)) by De Morgan’s for
3. w a ¬ f (P(w,f ) ∧ Q(f,a)) by De Morgan’s for
4. w a f ¬ (P(w,f ) ∧ Q(f,a)) by De Morgan’s for
5. w a f (¬ P(w,f ) ∨ ¬ Q(f,a)) by De Morgan’s for ∧.
Part 3: Can you translate the result back into English?
Solution:
“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”