Chapter 1
Chapter 1
• Logical Equivalence
• Important Logical Equivalences
• Showing Logical Equivalence
• Propositional Satisfiability
• Negation Laws: p ∨ ¬p ≡ T p ∧ ¬p ≡ F
8
(p q) r p (q r) ; (p q) r p (q r)
Associative Laws
12
List of Equivalences
p (q r) (p q) (p r) Distribution Laws
p (q r) (p q) (p r)
p q (p q) (q p) Biconditional Equivalence
13
Constructing New Logical Equivalences
•We can show that two expressions are
logically equivalent by developing a series
of logically equivalent statements.
•To prove that A B, we produce a series of
equivalences beginning with A and ending
with B. A A1
A1 A2
AB .
.
.
An B
14
Equivalence Proofs
Example: Show that (p (p q))
is logically equivalent to (p q)
Solution:
(p (p q)) p (p q) 2nd De Morgan L
p [(p ) q)] 1st De Morgan L
p (p q) Double Negation L
(p p) (p q) 2nd Distribution L
F (p q) (p p) F
(p q) F Commutative L for Disjunction
(p q) Identity L for F
15
Prove: p q q p Contrapositive
pq
p q Implication Equivalence
q p Commutative
(q) p Double Negation
q p Implication Equivalence
16
Prove: (p q) q p q
(p q) q Left-Hand Statement
q (p q) Commutative
(q p) (q q) Distributive
(q p) T OR Tautology
qp Identity
pq Commutative
Begin with exactly the left-hand side statement
End with exactly what is on the right
Justify EVERY step with a logical equivalence
Prove: p q p q
p q
(p q) (q p) Biconditional Equivalence
(p q) (q p) Implication Equivalence (twice)
(p q) (q p) Double Negation
(q p) (p q) Commutative
(q p) (p q) Double Negation
(q p) (p q) Implication Equivalence (twice)
p q Biconditional Equivalence
18
Why do I have to justify everything?
•Note that your operation must have the same
order of operands as the rule you quote unless
you have already proven (and cite the proof)
that order is not important.
3+4=4+3
3/44/3
A * B B * A for everything (for example, matrix
multiplication)
19
Propositional Satisfiability
• A compound proposition is satisfiable if there is an
assignment of truth values to its variables that make it true.
When no such assignments exist, the compound proposition
is unsatisfiable.
• 𝑛
=𝑗ٿ1 𝑝𝑗 is used for p1 p2 … pn
1.4 Predicate and quantifiers
3
1.4 Predicate and quantifiers
• Can be used to express the meaning of a wide range of
statements
• Allow us to reason and explore relationship between objects
• Predicates: statements involving variables e.g.
• “x > 3”
• “x = y + 3”
• “x + y = z”
• “computer x is under attack by an intruder”
• “computer x is functioning properly”
4
Example: x > 3
• The variable x is the subject of the statement
• Predicate “is greater than 3” refers to a property that the
subject of the statement can have
• Can denote the statement by P(x)
• where P denotes the predicate “is greater than 3” and x is the
variable
• P(x): also called the value of the propositional function P at x
• Once a value is assigned to the variable x, P(x) becomes a
proposition and has a truth value
5
Example
• Let P(x) denote the statement “x > 3”
• P(4): setting x = 4, 4 > 3 is true, thus P(4) is TRUE
• P(2): setting x = 2, 2 > 3 is false, thus P(2) is FALSE
• Let A(x) denote the statement “computer x is under attack by
an intruder”.
• Suppose that only CS2 and MATH1 are currently under attack
• A(CS1)? : FALSE
• A(CS2)? : TRUE
• A(MATH1)?: TRUE
∀m (S(m, 1) → C(m)).
32
Example
• “If a user is active, at least one network link will be available”
• Let A(u) represent “user u is active” where u has the domain of all
users
• and let S(n, x) denote “network link n is in state x” where
• n has the domain of all network links, and
• x has the domain of all possible states, {available, unavailable}.
∃u A(u) → ∃n S(n, available)
1.5 Nested Quantifiers
2
1.5 Nested quantifiers
Assume the domain for the variables x, and y consists of
real numbers R
∀x ∃y (x + y) = 0 says:
For every real number x, there exists a real number y
where x + y = 0
(this is true if we let y be –x)
∀x ∃y (x + y) = 0 same as ∀x Q(x) where
Q(x) is ∃y P(x, y) and P(x, y) is (x + y) = 0
∀x ∀y (x + y) = (y + x) says:
For every real number x, and every real number y,
(x + y) = (y + x)
- commutative law for addition of real numbers
3
Nested quantifiers
∀x ∃y P(x, y)
∃x ∀y P(x, y)
∃x ∃y P(x, y)
5
Quantification as loop
• For every x, for every y ∀x ∀y P(x,y)
• Loop through x and for each x loop through y
• If we find P(x,y) is true for all x and y, then the
statement is true
• If we ever hit a value x for which we hit a value for which
P(x,y) is false, the whole statement is false
• For every x, there exists y ∀x ∃y P(x,y)
• Loop through x until we find a y that P(x,y) is true
• If for every x, we find such a y, then the statement is true
6
Quantification as loop
• ∃x ∀y P(x,y): we loop through the values for x until we find
an x for which P(x, y) is always true when we loop through all
values for y. Once we find such an x, then it is true.
• ∃x ∃y P(x,y) : loop though the values for x where for each x
loop through the values of y until we find an x for which we
find a y such that P(x,y) is true.
• False only if we never hit an x for which we never find y
such that P(x,y) is true
7
Order of quantification
Order is important unless all quantifiers are universal quantifiers
or all are existential quantifiers
Let P(x, y) be the statement “x + y = y + x”, domain is R.
What are the truth values of
∀x ∀y P(x, y)
∀y ∀x P(x, y)
8
Order of quantification
∀x ∀y P(x, y) means
“for all real numbers x, for all real numbers y, x + y = y + x.”
an axiom for the real numbers R
∀x ∀y P(x, y) is true
∀y ∀x P(x, y) means
“for all real numbers y, for all real numbers x, x + y = y + x.”
same meaning as the above statement
∀y ∀x P(x, y) is true
The order of nested universal quantifiers in a statement without other
quantifiers can be changed without changing the meaning of the quantified
statement. ∀x ∀y P(x, y) ∀y ∀x P(x, y)
9
Order of quantification
Let Q(x, y) denote “x + y = 0.” What are the truth values of the
quantifications ∃y ∀x Q(x, y) and ∀x ∃y Q(x, y), Domain is R.
∃y ∀x Q(x, y) denotes the proposition
“ There is a real number y such that for every real number x, Q(x, y).”
No matter what value of y is chosen, there is only one value of x for which
x + y = 0. Because there is no real number y such that x + y = 0 for all real
numbers x, the statement ∃y ∀x Q(x, y) is false.
∀x ∃y Q(x, y) denotes the proposition
“For every real number x there is a real number y such that Q(x, y).”
Given a real number x, there is a real number y such that x + y = 0;
namely, y = −x. Hence, ∀x ∃y Q(x, y) is true.
Here the order in which quantifiers appear makes a difference. Be careful
with the order of existential and universal quantifiers!
10
Quantification of two variables
Statement When True? When False?
∀x∀yP(x, y) P(x, y) is true for every pair There is a pair x, y for which
∀y∀xP(x, y) x, y. P(x, y) is false.
For every x there is a y for There is an x such that P(x, y)
∀x∃yP(x, y)
which P(x, y) is true. is false for every y.
There is an x for which P(x, y) For every x there is a y for
∃x∀yP(x, y)
is true for every y. which P(x, y) is false.
∃x∃yP(x, y) There is a pair x, y for which P(x, y) is false for every pair
∃y∃xP(x, y) P(x, y) is true. x, y.
11
Order of Quantifiers
Example: Let Q(x, y, z) be the statement “x + y = z”. What are the
truth values of the quantifications
∀x ∀y ∃z Q(x, y, z) and ∃z ∀x ∀y Q(x, y, z), where the domain for all
variables consists of all real numbers?
Sol: ∀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” is true.
The order of quantification is important here. Since
∃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, x + y = z”, is false, because
there is no z that satisfies the equation x + y = z for all real numbers
x and y
12
Translating mathematical statements with Nested Quantifiers
• “The sum of two positive integers is always positive”
• First: we rewrite it so that the implied quantifiers and a
domain are shown:
• “For every two integers, if these integers are both
positive, then the sum of these integers is positive.”
• Next: we introduce the variables x and y to obtain
• “For all positive integers x and y, x + y is positive.”
• Next: ∀x ∀y ((x > 0) ∧ (y > 0) → (x + y > 0))
• where the domain for both variables consists of all
integers.
13
Translating mathematical statements with Nested Quantifiers
• Note that we could also translate this using the positive
integers as the domain
• “The sum of two positive integers is always positive”
• “For every two positive integers, the sum of these integers is
positive”
• ∀x ∀y (x + y > 0)
• where the domain for both variables consists of all
positive integers.
14
Example
• “Every real number except zero has a multiplicative inverse”
• (A multiplicative inverse of a real number x is a real number y
such that xy = 1.)
• “For every real number x except zero, x has a multiplicative
inverse.”
• “For every real number x, if x 0, then there exists a real
number y such that xy = 1.”
• ∀x ((x 0) → ∃y (xy = 1))
• Where the domain for both variables consists of real numbers
15
Translating predicates with nested Quantifiers to English
• Assume C(x) is “x owns a computer ”,
F(x,y) is “x and y are friends”, and the domain for x and y
consists of all students in An-Najah.
• Express the following in English:
• ∀x (C(x) ∨ ∃y (C(y) ∧ F(x, y)))
p→q
“If you have a current password,
then you can login to the network” q
p “You have a current password” premises
∴ therefore, p→q
q “You can login to the network” conclusion p→q
______
∴q
5
p
Valid arguments p→q
______
• (p ∧ (p → q)) → q is tautology ∴q
p q p→q (p → q) p ((p → q) p) → q
0 0 1 0 1
0 1 1 0 1
1 0 0 0 1 ∴ therefore
1 1 1 1 1
Consequently,
p
_______
or p (p q)
pq
14
Simplification
pq
_______ or (p q) p
p
15
Conjunction
p
q or ((p) (q)) p q
_______
pq
16
Modus Ponens
p
pq or (p (p q)) q
_______
q
17
Modus Tollens
q
pq or (q (p q)) p
_______
p
18
Hypothetical Syllogism
pq
p
_____ or, ((p q) p) q
q
20
Resolution
pq
p r
_____ or, ((p q) (p r )) (q r)
qr
21
22
Example
pq p q
________
p→q p→q
∴p _________ _________
∴q ∴p
27
So what did we show?
hypotheses (premises)
• We showed that:
• ((¬p q) (r → p) (¬r → s) (s → t)) → t
¬p q
• That when the 4 hypotheses are true, then
the implication is true r→p
• In other words, we showed the above is a ¬r → s
tautology!
s→t
Conclusion
t
28
So what did we show?
• To show this, enter the following into the truth table
generator at
http://turner.faculty.swau.edu/mathematics/materialslibrary/truth/
((~P & Q) & (R > P) & (~R > S) & (S > T)) > T
•Do you want to search for other truth table
generators?
29
Example
– Show that the premises (hypotheses)
– “If you send me an email message, then I will finish my
program”
– “If you do not send me an email message, then I will go to
sleep early”
– “If I go to sleep early, then I will wake up feeling refreshed”
–lead to the conclusion
–“If I do not finish writing the program, then I will wake up
feeling refreshed”
30
Solution
•Let
• 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”
31
Solution
– Show that the premises Premises (Hypotheses)
– “If you send me an email message, p→q
then I will finish my program”
– “If you do not send me an email
message, then I will go to sleep ¬p → r
early”
– “If I go to sleep early, then I will wake r→s
up feeling refreshed”
– lead to the conclusion
– “If I do not finish writing the program,
Conclusion
then I will wake up feeling refreshed” ¬q → s
•Universal generalization:
P(c) for arbitrary c U (U is the domain (Universe of Discourse))
___________________
x P(x) Note: c must be arbitrary
39
Rules of Inference for Quantified Statements
• Existential instantiation:
x P(x)
______
P(c) for some c U (U is the domain (Universe of Discourse))
Note that value of c is not known; we only know it exists
• Existential generalization:
P(c) for some c U
________________
x P(x)
40
Inference with quantified statements
Instantiation:
c is one particular member
of the domain
Generalization:
for an arbitrary member c
41
Example
Let P(x) = “A man is mortal”; then
x P(x) = “All men are mortal”
Since x P(x)
_______
P(c)
43
Example
Show that
“A student in this class has not read the book”, and “Everyone
in this class passed the first exam” imply “Someone who
passed the first exam has not read the book”
Show that “A student in this class has not read the book”, and “Everyone in this class passed the first
exam” imply “Someone who passed the first exam has not read the book”
C(x): x is a student in the class. B(x): x has read the book. P(x): x has passed the first exam
45
Universal modus ponens
•Use universal instantiation and modus ponens to
derive new rule
∀x (P(x) → Q(x))
P(a), where a is a particular element in the domain
∴ Q(a)
46
Example: Universal modus ponens
• Assume “For all positive integers n, if n is greater than 4, then n2 is
less than 2n” is true. Show 1002 < 2100.
• Solution:
• Let P(n) be “n > 4” and Q(n) be “n2 < 2n”
• The statement “For all positive integers n, if n is greater than 4, then
n2 is less than 2n” can be represented by ∀n(P(n) → Q(n))
• where the domain consists of all positive integers.
• We are assuming that ∀n(P(n) → Q(n)) is true.
• Note that P(100) is true because 100 > 4. It follows by universal
modus ponens that Q(100) is true, namely that 1002 < 2100
47
Universal modus tollens
•Combine universal modus tollens and universal
instantiation
∀x (P(x) → Q(x))
¬Q(a), where a is a particular element in the domain
∴ ¬P(a)
1.7 Introduction to proofs
3
Some terminology
• Theorem نظرية: a mathematical statement that can be shown to be true
(fact or result)
• Proposition فرضية: less important theorem
• Axiom ( بديهيةpostulate )مسلمة: a statement that is assumed to be true
• Lemma: less important theorem that is helpful in the proof of other
results
• Corollary الزمة: a theorem that can be established directly from a
theorem that has been proved
• Conjecture حدس: a statement proposed to be true, but not proven yet
4
Proof Techniques (Methods)
Four primary proof methods:
Direct Proof
Indirect Proof
Proof by Contradiction
Proof by Induction
q r1 r2 … rn p
12
Indirect Proof – Example
Prove that for an integer n, if 3n + 2 is odd, then n is odd.
Proof (by contraposition):
We need to show that if n is not odd then 3n + 2 is not odd
We need to show that if n is even then 3n + 2 is even
Thus, we assume that n is even
Then n = 2k for some integer k
Thus, 3n + 2 = 6k + 2 = 2 (3k + 1) = 2m for some integer m m = (3k + 1)
Thus, 3n + 2 is even. Hence if n is even then 3n + 2 is even. The
contrapositive of this statement is
if 3n + 2 is odd, then n is odd. This completes the proof.
13
When to use an indirect proof
• Sometimes a direct proof leads to a dead end.
Theorem: Prove that if n Z and n2 is even,
then n is even. (We will use this theorem in a latter proof)
Proof :
Try a direct proof: (start with p) n2 = 2k, and so
n = 2𝑘, and then ....???
Try an indirect proof (using contrapositive):
(q) n is odd n = 2k + 1 n2 = (2k + 1)2 = 4k2 + 4k + 1
= 2(2k2 + 2k) + 1 = 2m + 1 for some integer m
n2 is odd (p)
14
Example
• Prove that if n = ab, where a and b are positive integers, then 𝑎 ≤ 𝑛
or 𝑏 ≤ 𝑛.
Prove that if 𝑎 > 𝑛 and 𝑏 > 𝑛,
• What is the contrapositive?? where a and b are positive integers,
then n ≠ ab.
Prove by contraposition (p → q ¬q → ¬p)
Assume ¬(𝑎 ≤ 𝑛 𝑏 ≤ 𝑛)
(𝑎 > 𝑛 𝑏 > 𝑛)
𝑎𝑏 > 𝑛. 𝑛 = 𝑛
𝑎𝑏 ≠ 𝑛, which contradicts the statement n = ab ¬(n = ab)
• Because the negation of the conclusion of the conditional statement implies that
the hypothesis is false, the original conditional statement is true. We have Proven
that if n = ab, where a and b are positive integers, then 𝑎 ≤ 𝑛 or 𝑏 ≤ 𝑛.
15
Proof by Contradiction (another type of indirect proof)
• Can be used to prove statements of the form: p or p q
• To prove p by contradiction, we show that the negation of p
(i.e., p) leads to some kind of a contradiction (false
proposition) like (r r)
• To prove p q by contradiction, we assume the
negation of p q and try to get a contradiction.
• (p q) (p q) (p q)
• (i.e., we assume p q) and try to get a contradiction,
i.e., (p q) F or (p q) p [or (p q) q]
16
Proof by Contradiction – Ex: Prove that 2 is irrational.
• Assume 2 is not irrational, i.e., 2 is rational. i.e., 2 = n/m for
some integers n and m 0 where n and m have no common factors.
• If 2 = n/m then 2 = n2/m2, i.e., 2m2 = n2 (1)
• (1) states that n2 is even n is even (by previous theorem) (P)
• Because n is even (assume n = 2k), we can rewrite (1) as
• 2m2 = 4k2
• Thus (by dividing both sides by 2),
• m2 = 2k2 (2)
• (2) state that m2 is even m is even (by previous theorem) (Q)
• We have just shown (P and Q) that both n and m are even, i.e., they
have a common factor. This is a contradiction with our starting
assumption.
17
Example
• Proof by contradiction “If 3n + 2 is odd,
then n is odd”
• Let p be “3n + 2 is odd” and q be “n is odd”
• So we want to prove that p q or (p q) is true.
• To construct a proof by contradiction, assume both p
and q (n is even) are both true, i, e. (p q)
• Since n is even, let n = 2k, then 3n + 2 = 6k + 2
= 2(3k + 1). So 3n + 2 is even, i.e. p,
• Both p and p are true, so we have a contradiction
18
Proof by Contradiction – Example
Prove that if 16 bicycles are painted red, white and
green then at least 6 bicycles will have the same color.
Proof (by contradiction):
• Assume not, i.e., for each color there is < 6 (i.e., 5)
bicycles.
• Then (compute the number of cycles from the view
point of colors) the number of cycles is
(3 × ( 5)) 15 bicycles,
which contradicts the premise that there are 16
bicycles.
19
Theorem
• n is even if and only if nk is even for any integer k > 1.
• n is odd if and only if nk is odd for any integer k > 1.
• Notes:
• “p if and only if q” is often written as
p ↔ q (that is, p → q and q → p)
• To prove “p if and only if q”, we must prove “if
p then q” and “if q then p”.
20
Example
• Prove the theorem “If n is a positive integer, then n
is odd if and only if n2 is odd”
• To prove “p if and only if q” where p is “n is odd” and
q is “n2 is odd”
• Need to show p → q and q → p
“If n is odd, then n2 is odd”, and “If n2 is odd, then n
is odd”
• We have proved p → q and q → p in previous
examples and thus prove this theorem with iff
21
Proof of equivalence
•To prove a theorem that is a biconditional
statement p ↔ q, we show p → q and q → p
•The validity is based on the tautology
(p ↔ q) ↔ ((p → q) ˄ (q → p))
22
Proving Equivalence of Three Propositions
• To prove that P Q R, it suffices (and is more efficient) to
prove:
(P Q) (Q R) (R P)
• In general,
[p1 p2 … pn]
[(p1 p2) (p2 p3) … (pn p1)]
• (P) n is even n = 2k
n - 1 = 2k - 1 = 2(k - 1) + 1 = 2m + 1
n - 1 is odd (Q)
• (Q) n - 1 is odd n - 1 = 2k + 1 n = 2k + 1 + 1
n = 2(k + 1) n2 = 4 (k + 1)2 = 2 (2 (k + 1)2) = 2m
n2 is even (R)
• (R) n2 is even n is even (P) by a previous theorem
24
Equivalent theorems
• p1 ↔ p2 ↔ … ↔ pn
• For i and j with 1 ≤ i ≤ n and 1 ≤ j ≤ n,
pi and pj are equivalent
[p1 ↔ p2 ↔ … ↔ pn] ↔
[(p1 → p2) ˄ (p2 → p3) ˄ … ˄ (pn → p1)]
• More efficient than prove pi → pj for i ≠ j with
1 ≤ i ≤ n and 1 ≤ j ≤ n
• Order is not important as long as we have chain
25
Prove False by a Counterexample
• Prove that every positive integer is the sum of
the squares of two integers.
• The statement to be proven is false.
• The following is a counterexample:
For number 3, 3 = 2 + 1 or 3 = 3 + 0.
None of these cases is a sum of two squares.
26
Vacuous & Trivial Proofs
Consider p q
• Vacuous proof: if p is false then p q is always true.
• Trivial proof: if q is true then p q is always true.
• Examples:
• If 0 > 1, then n2 > n for any integer n.
• (vacuous proof)