Logic&Set Theory Module 1
Logic&Set Theory Module 1
Mathematical Logic
Module 1
Propositional
Logic
Introduction
Mathematical logic is the discipline that
mathematicians invented in the late
nineteenth and early twentieth centuries so
they could stop talking nonsense. It’s the
most powerful tool we have for reasoning
about things that we can’t really comprehend,
which makes it a perfect tool even for other
disciplines in science and technology.
2
Learning
Write proofs for Outcome
mathematical statements
and arguments
Learning
Objectives
1. Define proposition and determine whether or
not a given expression is a proposition
2. Construct the truth table of a given proposition
and determine if it is a tautology, a contradiction,
or a contingency
3. Prove equivalences using the rules of
replacement
4. Determine the validity of an argument
Content
3
Propositional logic
Propositional logic is the simplest form of logic. Here the only
statements that are considered are propositions, which contain no variables.
Since propositions contain no variables, they are either always true or always
false.
Examples of propositions:
• 2 + 2 = 4. (Always true).
• 2 + 2 = 5. (Always false).
Examples of non-propositions:
• x + 2 = 4. (May be true, may not be true; it depends on the value of
x.)
• x · 0 = 0. (Always true, but it’s still not a proposition because of the
variable.)
• x · 0 = 1. (Always false, but not a proposition because of the
variable.)
Example 1.1 Which of the following are propositions? Give the truth
value of the propositions.
a. The difference of two primes.
b. 2 + 2 = 4.
c. Washington D.C. is the capital of New York.
d. How are you?
4
Solution.
a. Not a proposition.
b. A proposition with truth value (T).
c. A proposition with truth value (F).
d. Not a proposition
Operations on Propositions
Propositions by themselves are pretty boring. So boring, in fact,
that logicians quickly stop talking about actual statements and instead
haul out placeholder names for propositions like p, q, or r.
1. Negation
The negation of p is written as ¬p, or sometimes p. It has the
property that it is false when p is true, and true when p is false.
2. Disjunction (Or )
The disjunction of two propositions p and q is written as p ∨ q,
and is true as long as at least one, or possibly both, of p and q is true.
This is not always the same as what “or” means in English; in English,
“or” often is used for exclusive or which is not true if both p and q are
true. For example, if someone says “You will give me all your money or
I will stab you with this table knife”, you would be justifiably upset if
you turn over all your money and still get stabbed. But a logician would
not be at all surprised, because the standard “or” in propositional logic
is an inclusive or that allows for both outcomes
3. Conjunction (And)
5
4. Implication
This is the most important connective for proofs. An implication
Pope”, “If I’m the Pope, then 2 + 2 = 4”, and “If 2 + 2 = 4, then 3 + 3
= 6”, are all true, provided the if/then is interpreted as implication.
Normal English usage does not always match this pattern; instead,
if/then in normal speech is often interpreted as the much stronger
biconditional (see below).
5. Biconditional
Suppose that p → q and q → p, so that either both p and q are
true or both p and q are false. In this case, we write p ↔ q and say
that p holds if and only if q holds. The truth of p ↔ q is still just a
function of the truth or falsehood of p and q; though there doesn’t
seem any connection between the two sides of the statement, “2 + 2
= 5 if and only if I am the Pope” is still true (provided it is not uttered
by the Pope). The only way for p ↔ q to be false is for one side to be
true and one side to be false.
Compound Proposition
6
NOT p ¬p
p OR q p∨q
p AND q p∧q
p implies q p→q
p iff q p↔q
Example 1.2
Let p:5<9
q : 9 < 7.
Construct the propositions p ∧ q and p ∨ q.
Solution.
The conjunction of the propositions p and q is the proposition
p∧q: 5 < 9 and 9 < 7.
The disjunction of the propositions p and q is the proposition
p∨q: 5 < 9 or 9 < 7
p : It is Friday
q : It is raining.
Solution.
The conjunction of the propositions p and q is the proposition
p ∧ q : It is Friday and it is raining.
The disjunction of the propositions p and q is the proposition
p ∨ q : It is Friday or It is raining.
Truth Tables
To define logical operations formally, we construct a truth table.
A truth table displays the relationships between the truth values of
propositions. This gives, for any combination of truth values (true or
false, or often written as 1 for true and 0 for false) of the inputs, the
truth value of the output. So, truth tables are to logic what addition
tables or multiplication tables are to arithmetic. Here is a truth table
for negation:
¬ p ¬
p
1 0
0 1
And here is a truth table for the rest of the logical operators:
p q p˅q p˄q p→ p↔
8
q q
1 1 1 1 1 1
1 0 1 0 1 0
0 1 1 0 0 0
0 0 0 0 1 1
Some examples:
p ¬p p˄¬ 0
9
p
1 0 0 0
0 1 0 0
and observe that the last two columns are always equal.
p p˅p
1 1
0 0
• p → q ≡ ¬p ∨ q
p q p→q ¬p ∨
q
1 1 1 1
1 0 0 0
0 1 1 1
0 0 1 1
same
Solution.
p q r p˄q ¬(p˄q) [¬(p˄q)]˅
r
1 1 1 1 0 1
1 1 0 1 0 0
1 0 1 0 1 1
1 0 0 0 1 1
0 1 1 0 1 1
0 1 0 0 1 1
0 0 1 0 1 1
0 0 0 0 1 1
Example 2.3
a. Construct the truth table of the proposition (p ∧ q) ∨ (¬ p ∨ ¬ q).
Determine if this proposition is a tautology.
b. Show that p ∨ ∼ p is a tautology.
Solution.
a.
¬ ¬ p ˄ q ¬p ˅ ¬q (p ∧ q) ∨ (¬ p ∨
¬ q)
p q
p q
1 1 0 0 1 0 1
1 0 0 1 0 1 1
0 1 1 0 0 1 1
0 0 1 1 0 1 1
11
Solution.
¬p
¬p
p p˅
1 0 1
0 1 1
p ¬ p∧ ¬
p p
1 0 0
0 1 0
Example 2.5 Construct the truth table for (p˄q) →¬ p and classify it
as a tautology, contradiction, or a contingency.
Solution:
p q ¬ p˄q (p˄q)→¬
p p
1 1 0 1 0
1 0 0 0 1
0 1 1 0 1
0 0 1 0 1
12
Logical Equivalence
Example 2.6
a. Show that ¬ (p ∨ q) ≡¬ p∧ ¬ q.
b. Show that ¬ (p ∧ q) ≡¬ p ∨ ¬ q.
c. Show that ¬ (¬ p) ≡ p.
Solution.
¬ ¬ p ˅ q ¬(p ˅ ¬p
¬q
p q ˄
p q q)
1 1 0 0 1 0 0
1 0 0 1 1 0 0
0 1 1 0 1 0 0
0 0 1 1 0 1 1
Therefore, ¬ (p ∨ q) ≡¬ p∧ ¬ q.
13
¬ ¬ ˄ ¬(p ˄ ¬p
¬q
p q p ˅
p q q q)
1 1 0 0 1 0 0
1 0 0 1 0 1 1
0 1 1 0 0 1 1
0 0 1 1 0 1 1
Therefore, ¬ (p ∧ q) ≡¬ p ∨ ¬ q.
c.
p ¬p ¬(¬p
)
1 0 1
0 1 0
Therefore,
Therefore, ¬ (¬ p) ≡ p.
Example 2.7
Solution.
14
p q p∧ q∧
q p
1 1 1 1
1 0 0 0
0 1 0 0
0 0 0 0
p q r p ∨ (p ∨ q) ∨ q∨ p ∨ (q ∨
q r r r)
1 1 1 1 1 1 1
1 1 0 1 1 1 1
1 0 1 1 1 1 1
1 0 0 1 1 0 1
0 1 1 1 1 1 1
0 1 0 1 1 1 1
0 0 1 0 1 1 1
0 0 0 0 0 0 0
Show (p ∧ q) ∧ r ≡ p ∧ (q ∧ r).
15
p q r p ˄q (p ˄ q) ˄ q˄r p ˄ (q ˄
r r)
1 1 1 1 1 1 1
1 1 0 1 0 0 0
1 0 1 0 0 0 0
1 0 0 0 0 0 0
0 1 1 0 0 1 0
0 1 0 0 0 0 0
0 0 1 0 0 0 0
0 0 0 0 0 0 0
p ˄ q (p ∧ q) ∨ p ˅ (p ∨ r) ∧ (q
∨ r)
p q r q˅
r r r
1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1
1 0 1 0 1 1 1 1
1 0 0 0 0 1 0 0
0 1 1 0 1 1 1 1
0 1 0 0 0 0 1 0
0 0 1 0 1 1 1 1
0 0 0 0 0 0 0 0
p q r p ˅ q (p ˅ q) ˄ p˄ q˄ (p ˄ r) ˅ (q ˄
r r r r)
1 1 1 1 1 1 1 1
1 1 0 1 0 0 0 0
1 0 1 1 1 1 0 1
1 0 0 1 0 0 0 0
0 1 1 1 1 0 1 1
0 1 0 1 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0
Let us recall that the truth table for implication, that is,
p q p→q
1 1 1
1 0 0
0 1 1
0 0 1
It follows from the truth table that the proposition p → q is always true
if the hypothesis p is false, regardless of the truth value of q. We say
that p → q is true by default or vacuously true. In terms of words
the proposition p → q also reads:
(a) if p then q.
(b) p implies q.
17
Example 2.9
a. Show that ¬ (p → q) ≡ p∧ ¬ q.
b. Find the negation of the statement “ If my car is in the repair shop,
then I cannot go to class.”
Solution.
We can also use the rules of replacement in showing equivalence
between two propositions. The procedure is outlined as follows:
a. ¬ (p → q) ≡ ¬ (¬ p ∨ q) (by Material Implication)
≡ ¬ (¬ p) ∧ ¬ q (by De Morgan’s Law)
≡ p∧ ¬ q. (by Double Negation)
b. “My car is in the repair shop and I can get to class.”
→ q is the proposition ¬ q →¬ p.
18
≡p→q
p q p↔
q
1 1 1
1 0 0
0 1 0
0 0 1
Example 2.13
Show that the biconditional proposition of p and q is logically
equivalent to the conjunction of the conditional propositions p → q and
q → p.
Solution.
Example 3.1 Show that the propositions “The star is made of milk,
and strawberries are red. My dog has fleas.” do not form an argument.
Solution.
Indeed, the truth or falsity of each of the propositions has no bearing
on that of the others.
Example 3.2 Show that the propositions: “Mark is a lawyer. So, Mark
went to law school since all lawyers have gone to law school” form an
argument.
Solution.
This is an argument. The truth of the conclusion, “Mark went to law
school,” is inferred or deduced from its premises, “Mark is a lawyer”
and “all lawyers have gone to law school.”
The above argument can be represented as follows:
Let p: Mark is a lawyer.
q: All lawyers have gone to law school.
r: Mark went to law school.
Then p∧q
∴r
Rules of Inference
The following rules can be used to prove the validity of an
argument.
1. Modus Ponens or the Method of Affirming
p→q
p
∴q
3. Disjunctive Addition
a) p
22
∴ p∨q
or b) q
∴ p∨q
4. Conjunctive Addition
a) p
q
∴ p˄q
or b) p
q
∴ q˄p
5. Conjunctive Simplification
a) p ∧ q
∴p
or b) p ∧ q
∴q
6. Disjunctive Syllogism
p∨q
¬q
∴p
7. Hypothetical Syllogism
p→q
q→r
∴p→r
23
p→q
The second statement is a negation statement. In fact, it is a negation
of q. Thus, its symbolic form is
¬q
Solution.
r→ s
r
p→q
q→p
25
∴p ∨ q
Solution.
Statement Reason
1) p → q 1) Premise
2) ¬p ˅ q 2) Material Implication (1)
3) ∴ q 3) Disjunctive Addition (2)
4) q → p 4) Premise
5) ∴ p 5) Modus Ponens (4)(3)
6) ∴ p ˅ q 6) Disjunctive Addition (5)
p∨r
r→q
s∨∼q
∼s
∴p
Solution:
Statement Reason
1) s ∨ ∼ q 1) Premise
2) ∼ s 2) Premise
3) ∼ q 3) 1, 2, Disjunctive Syllogism
4) r → q 4) Premise
5) ∼ r 5) 3, 4, Law of Contraposition
6) p ∨ r 6) Premise
7. ∴ p 7) 5, 6, Disjunctive Syllogism
Solution.
Since 4 ∈ R and 4 > 3, the given proposition is true.
29
Example 4.7
a. What is the negation of the proposition ∀x ∈ D, P(x)?
b. What is the negation of the proposition ∃x ∈ D, P(x)?
c. What is the negation of the proposition ∀x ∈ D, P(x) → Q(x)?
Solution.
a. ∃x ∈ D, ¬ P(x).
b. ∀x ∈ D, ¬ P(x).
c. Since P(x) → Q(x) ≡ (¬ P(x)) ∨ Q(x) (by material implication), we
have ¬ (∀x ∈ D, P(x) → Q(x)) ≡ ∃x ∈ D, P(x)∧ ¬ Q(x)
Assessment Tasks 1
a. p→q
∼q
p∨s
∴s
b. (q ∨ r) → p
∼p
s→r
∴∼ s
References
32
1. [Link]
[Link]
2.
[Link]
[Link]
3.
[Link]
09/[Link]
4. [Link]
Prepared by: