Chapter 1 Logic
Chapter 1 Logic
L1
OBJECTIVES:
DEFINE THE SIMPLE AND COMPOSITE STATEMENTS.
DEFINE THE NEGATION, CONJUCTION, DISJUNCTION.
CONSTRUCT THE TRUTH TABLE.
Logic is a study of the principles and methods used in distinguishing valid arguments
from those that are not valid.
Definition 1
A statement is a declarative sentence that is
either true or false, but not both concurrently.
Example 1
a. Today is Wednesday. (This is a statement since one can definitely say this is true
or not depending on when we declare this sentence. In the given case it is false.)
e. 𝑎 + 𝑏 < 4. This is not a statement unless we assume that for example 𝑎 = 2 and
𝑏 = 1.
f. Do you do this assignment by yourself? This is not a statement but question.
j. A complex number 2+3i is more than 3+3i. This is not a statement since they are
not comparable.
k. This proposition is true. This is not a statement but paradox.
1
Definition 2
A statement that is made of only one sentence is called a
simple statement.
There are no connective words such as ‘and’, ‘or’,
‘if…then…’, ‘…if and only if…’, ‘When ….’,
‘…before..’, ‘Since….’
Example 2
Definition 3
A compound statement is a combination of two or more
simple statement.
(Istilah Bahasa Melayu: Pernyataan majmuk)
1) Connective ~
b. q : 2+2 = 4
~𝑞: 2 + 2 ≠ 4
c. r :2+2<5
~𝑟 ∶ 2 + 2 ≥ 5
2. Connective
Definition 5
Let p and q be statement Table 2: The Truth Table for conjunction
variables. The conjunction
of p and q is p and q, p q p q
denoted 𝑝 ∧ 𝑞. It is true T T T
when, and only when, both T F F
p and q are true. If either p F T F
or q is false, or if both are F F F
false, 𝑝 ∧ 𝑞 is false.
The number of combinations : 22
Example 4:
p: Today is raining.
q: I can’t attend the class.
3
3. Connective
The only way for a disjunction to be a false statement is if BOTH halves are false. A
disjunction is true if either statement is true or if both statements are true! In other words,
the statement 'The clock is slow or the time is correct' is a false statement only if both
parts are false! Likewise, the statement 'Mr. G teaches Math or Mr. G teaches Science' is
true if Mr. G is teaches science classes as well as math classes!
Example 5:
Construct the truth table for the following compound statements.
a. p q ~ p
b. ~ ~ p ~ q
c. ~(𝑝 ∨ 𝑞) ∧ 𝑟
Solution
a.
(p q) ~p
T T T F F
T F F F F
F F T F T
F F F F T
Steps 1 22 1 4 3
Conclusion
4
b.
~ (~ p ˄ ~ q)
T F T F F T
T F T F T F
T T F F F T
F T F T T F
Steps 4 2 1 3 2 1
Conclusion
c.
5
L2
OBJECTIVES:
DEFINE THE CONDITIONAL AND BICONDITIONAL
CONSTRUCT THE TRUTH TABLE.
4. Connective
Example 6:
Note: The word 'then' is optional, and a conditional will often not include 'then'.
The example above could have been expressed: If you are absent, you have a
make up assignment to complete.
p q p →q
you are late you are on time If you are late, then you are on time.
True False The entire statment is false
The opposite situation does not lead to a false statement. A false 'if' clause and a
true 'then' clause creates a true statement. (Seems counterintuitive at first!) See the
table below for an example.
6
c. Example of a true conditional
p q p →q
If a human is a cat, then squares have
a human is a cat squares have corners
corners.
False True The entire statement is true.
Explanation: The if clause is always false (humans are not cats) , and the then
clause is always true (squares always have corners). And the entire statement is
true
Terminology:
The converse of 𝑝 → 𝑞 is 𝑞 → 𝑝.
The inverse of 𝑝 → 𝑞 𝑖𝑠 ~𝑝 → ~ 𝑞.
The contrapositive of 𝑝 → 𝑞 is ~𝑞 → ~𝑝 .
Example 7
The contrapositive for ‘If a human is a cat then squares have corners.’ is ‘If the squares
doesn’t have corners then a human is not a cat.’.
7
5. Connective
The compound statement (p q)⋀(q p) is a conjunction of two conditional
statements. In the first conditional, p is the hypothesis and q is the conclusion; in the
second conditional, q is the hypothesis and p is the conclusion. Let's look at a truth table
for this compound statement.
p q p q q p (p q) ⋀ (q p)
T T T T T
T F F T F
F T T F F
F F T T T
In the truth table above, when p and q have the same truth values, the compound
statement (p q) ⋀ (q p) is true. When we combine two conditional statements this
way, we have a biconditional.
Example 8:
a. A triangle is isosceles if and only if the triangle has two congruent (equal) sides.
The "if and only if" portion of the definition tells you that the statement is true when
either sentence (or fact) is the hypothesis. This means that both of the statements below
are true:
8
b. r: x + 2 = 7
s: x = 5
The biconditonal r s represents the sentence: "x + 2 = 7 if and only if x = 5."
When x = 5, both r and s are true. When x 5, both r and s are false. A biconditional
statement is defined to be true whenever both parts have the same truth value.
Accordingly, the truth values of r s are listed in the table below.
r s r s
T T T
T F F
F T F
F F T
9
L3
OBJECTIVES:
DEFINE THE LOGICALLY EQUIVALENT.
CONSTRUCT THE TRUTH TABLE.
Definition 10
When two statements P and Q, simple or compound, have the same truth values in each
of all possibilities, then P is said to be logically equivalent or simply equivalent to Q
and denoted 𝑃 ≡ 𝑄.
For example, let P and Q have the same truth values as given as follows:
P Q
T T
T T
F F
F F
T T
F F
F F
T T
≡
then 𝑃 ≡ 𝑄.
Example 9
Prove the following statements by using truth tables.
a. p q ~ ~ p ~ q
b. p q ~ p ~ q
c. pq p q q p
d. “It is not the case that Muhammad is rich or famous." is equivalent to
“Muhammad is not rich and he is not famous."
Solutions:
a.
10
p ∨ q ~ (~ p ˄ ~ q
T T T T F F F
T T F T F F T
F T T T T F F
F F F F T T T
1 2 1 5 3 4 3
Conclusion: p q ~ ~ p ~q
b.
~ (p ˄ ~ q) 𝑝→ 𝑞
T T F F T T
F T T T F F
T F F F T T
T F F T F T
4 1 3 2 1 5
≡
Conclusion:
p q ~ p ~ q
c.
p ↔ q (𝒑 → 𝒒) ∧ (𝒒 → 𝒑)
T T T T T T
T F F F F T
F F T T F F
F T F T T T
1 2 1 2 3 2
Conclusion: pq p q q p
d. Let i: Muhammad is rich.
11
j: Muhammad is famous.
Now, prove that ~(𝑖 ∨ 𝑗) ≡ ~𝑖 ∧ ~𝑗 using truth table.
~ (i ∨ j) ~ i ∧ ~ j
F T T T F F F
F T T F F F T
F F T T T F F
T F F F T T T
3 1 2 1 4 5 4
≡
Theorem 1:
3. pq q p;
pq q p Commutative Law (Com)
5. 𝑝 → 𝑞 ≡ ~𝑝 ∨ 𝑞 Implication law
6. p q ~ q ~ p Contrapositive (ContraPos)
7. ~ p q ~ p ~ q ;
~ p q ~ p ~ q De Morgan’s Laws (DeM)
8. p q r p q r ;
p q r p q r Associative Law
9. p q r p q p r ;
12
p q r p q p r Distributive Law
Prove
6.
p q ~ q ~ p
T T T F T F
T F F T F F
F T T F T T
F T F T T T
Step 1 2 1 3 4 3
≡
Conclusion: p q ~ q ~ p
Remarks:
1. 𝒑 ≡ 𝒑 ∨ 𝒑 ----- idempotence of
What this says is, for example, that "Abdullah is happy." is equivalent to " Abdullah is
happy or Abdullah is happy".
2. ~ ~ p p ----- double negation
What this says is, for example, that "It is not the case that Tom is not 6 foot tall." is
equivalent to "Tom is 6 foot tall."
5. 𝑝 → 𝑞 ≡ ~𝑝 ∨ 𝑞 ----- implication
For example, the statement "If you help me, I will give you a reward." is not true, that is,
I am lying, if you help me and I don't give you a reward. It is true in all the other cases.
Similarly, the statement "You are not help me or I give you a reward." is false, if you
help me and I don't give you a reward. It is true in all the other cases. Thus these two
13
statements are logically equivalent.
7. ~ p q ~ p ~ q ----- DeMorgan's Law
For example, "It is not the case that Abdullah is rich and famous." is true if and only if "
Abdullah is not rich or he is not famous."
8.
pq r p qr ----- associativity of
" Abdullah is rich or famous, or he is also happy." is equivalent to " Abdullah is rich, or
he is also famous or happy".
9.
p q r p q p r ----- distributivity of over
What this says is, for example, that " Abdullah is rich, and he is famous or happy." is
equivalent to " Abdullah is rich and famous, or Abdullah is rich and happy".
Exercises
14
L4
OBJECTIVES:
DEFINE THE TAUTOLOGY, IMPLICATION, EQUIVALENCE.
CONSTRUCT THE TRUTH TABLE.
Example 10:
T T F
F T T
conclusion
Observe that the statement p ~ p is TRUE in every case, that is TRUE in all
logical possibilities. Such type of statement is called a tautology.
𝑟 ˄ 𝑠 → 𝑠
T T T T
T F F T
F F T T
F F F T
15
Example 11:
The following conditional statements are examples of the implication:
1. 𝑝→𝑝
2. pq q p
3. pq p
4. pq q
5. pq q p
1.
𝑝 → 𝑝
T T
F T
Hence 𝑝 → 𝑝 is a tautology. We can write 𝑝 ⇒ 𝑝
5.
p ⋀ q → q p
T T T T T
T F F T F
F F T T T
F F F T F
1 2 1 4 3
16
NOTICE THAT:
P Q 𝑷⟹𝑸
F F T
F T T
T F F
T T T
If you start out with a false premise, then, as far as implication is concerned, you are free
to conclude anything. (This corresponds to the fact that, when P is false, the implication
P→Q is true no matter what Q is.)
If you start out with a true premise, then the implication should be true only when the
conclusion is also true. (This corresponds to the fact that, when P is true, the truth of the
implication is the same as the truth of Q .)
In your truth table, look only at the lines where P⟹Q holds (is T ), i.e., drop the third
line. In the remaining lines, for each line where P holds (i.e., the last T) Q holds as well.
Source:
http://math.stackexchange.com/questions/100286/the-meaning-of-implication-in-
logic
Notice that requiring that Q be true whenever P is true is the same thing as saying
that it will never happen that P is true but Q is false. Thus, the compound statement
form will have no entries of false in its truth table. This makes 𝑃 → 𝑄 a tautology.
17
Theorem 2.
2. 𝒑∧𝒒 ⇒𝒑 ;
𝒑∧𝒒 ⇒𝒒 Law of Simplification(Simp)
4. p q q r p r ; Transitive Law
Proof: We shall prove the above theorem by constructing the truth table.
Theorem 2(1)
p p ∨ q
T T T T
T T T F
F T T T
F T F F
Step 1 3 2 1
p pq
Conclusion:
18
Definition 13: If the biconditional statement pq is a tautology then
it is called an equivalence and is denoted by p q.
pq and pq have the same meaning and hence is used
interchangeably.
Example 12
p q ~ q ~ p
T T T F T F
T F F T F F
F T T F T T
F T F T T T
Step 1 2 1 3 4 3
≡
Conclusion: p q ~ q ~ p
OR
p q ~ q ~ p
T T T T F T F
T F F T T F F
F T T T F T T
F T F T T T T
Step 1 2 1 5 3 4 3
p q ⟺ ~ q ~ p or p q ≡ ~ q ~ p .
19
L5
OBJECTIVE:
FIND THE CONTRADICTION.
PROOF THE COMPOUND STATEMENTS BY USING DEDUCTIVE
REASONING.
1.3 Contradiction
Definition 14
A contradiction is a statement form that is always FALSE for each logical possibility.
Such statements are called contradictions and denoted as a symbol c .
Theorem 3
Let t, c and p, respectively be a tautology, a contradiction, and an arbitrary statement.
Proof.
(a)
𝒑 ∧ ~𝒑 c
T F F F
F F T F
≡
𝒑 ∨ ~𝒑 t
T T F T
F T T T
20
(c)
𝑝∨𝑡 ↔ 𝑡
T T T T T
F TT T T
Conclusion: 𝑝 ∨ 𝑡 ⇔ 𝑡
pc c
Conclusion: 𝑝 ∧ 𝑐 ⇔ 𝑐
(d)
c p
F T T
F T F
Conclusion: c⟹𝑝
The laws summarized in Theorems 1,2 and 3 are very useful tools for
justifying/proving the logical equivalences and implications. We shall call these
laws the rules of inference. Many logical equivalences and implications can be
established deductively by using other laws and relevant definitions and theorems
that we had proved. The method of proving used in the following Example is
called deductive reasoning or deductive method.
Example 13:
Prove
(a) ~(~𝑞) ∨ ~𝑝 ≡ 𝑞 ∨ ~𝑝
(b) ~𝑝 ⋀ ~𝑞 ≡ ~(𝑝 ∨ 𝑞)
(c) (𝑝 → 𝑟) ∨ (𝑞 → 𝑠) ≡ (𝑝 ∧ 𝑞) → (𝑟 ∨ 𝑠)
(d) (𝒑 → 𝒒) ∧ (𝒓 → 𝒔) ⟹ (~𝒒 ∨ ~𝒔) → (~𝒑 ∨ ~𝒓)
(e) (𝒑 → 𝒒) ∧ 𝒑 ⟹ 𝒒
by deductive reasoning.
21
Solution:
(c)
(𝑝 → 𝑟) ∨ (𝑞 → 𝑠) ≡ (~𝑝 ∨ 𝑟) ∨ (~𝑞 ∨ 𝑠) by Implication law
≡ (~𝑝 ∨ 𝑟 ∨ ~𝑞) ∨ 𝑠 ass law
≡ (~𝑝 ∨ ~𝑞 ∨ 𝑟) ∨ 𝒔 com
≡ (~𝑝 ∨ ~𝑞) ∨ (𝑟 ∨ 𝑠) ass
≡ ~(𝑝 ∧ 𝑞) ∨ (𝑟 ∨ 𝑠) DM
≡ (𝑝 ∧ 𝑞) → (𝑟 ∨ 𝑠) Implication law
d)
(𝒑 → 𝒒) ∧ (𝒓 → 𝒔) ≡ (~𝒒 → ~𝒑)⋀(~𝒔 → ~𝒓) contrapositive
⟹ (~𝒒 ∨ ~𝒔) → (~𝒑 ∨ ~𝒓) contructive dilemmas
(𝒆) (𝒑 → 𝒒) ∧ 𝒑 ⟹ 𝒒
Remark:
The reasons for using deductive reasoning as opposed to truth tables may be seen from
the following comparison:
To verify the equivalence in the Example 13© and d) by the method of constructing truth
table, we need to build a huge truth table with 16 = 24 logical possibilities, on the other
hand we can established that equivalence in a few steps using deductive reasoning.
Example 14:
Without construct a truth table, simplify the following statement:
~(~𝑝 ∧ 𝑞) ∧ (𝑝 ∨ 𝑞).
Solution:
≡ 𝑝 ∨ (~𝑞 ∧ 𝑞) dist
≡𝑝∨𝑐
≡𝑝
22
L6
OBJECTIVES:
FIND THE QUANTIFIER LAWS.
PROOF THE MATHEMATICAL INDUCTION
1. x px means that for all x in U , such that the statement px about
x is true. This is a universal statement involving p(x).
2. x px means that there exists at least one x in U , such that the
In mathematics, “for every x ” and “for all x ” mean the same and both are symbolized
byx ; and “for some x ” and “there exists at least one x ” is both symbolized by
x .
x ~ p x .
Rule of Quantifier Negation (QN):
~ x p x x ~ p x
23
~ x p x x ~ p x .
Example 15:
x px means “All snakes are poisonous” . This is a universal statement
involving p(x).
Example 16:
x px is
The negation of
24
1.6. Mathematical Induction.
Another method of proof that is very useful in proving the validity of a mathematical
statement P (n ) involving the natural number n is the following principle of
mathematical induction.
Mathematical Induction.
Let 𝑃𝑛 be a statement involving the natural number 𝑛. To prove that 𝑃𝑛 is true for all
natural numbers, the following steps are required.
Step 1: Show that 𝑃1 is true.
Step 2: Assume it is true for 𝑃𝑘 , 𝑘 is a natural numbers.
Step 3: Show that 𝑃𝑘+1 is also true.
Then the statement 𝑃𝑛 is true for all natural numbers.
After the first step, we can proceed the proof that 𝑃𝑛 is true for all natural numbers by
showing in detail that 𝑃2 is true, after that 𝑃3 is true and so on until 𝑃𝑛 is true. But such
method is not practical. It is sufficient to prove that 𝑃𝑘+1 is true as mentioned in the Step
3.
Example 17.
Prove by mathematical induction the following statements for every natural number n .
1
1.2 2.3 . . . r (r 1) . . . n(n 1) n(n 1)(n 2).
a. 3
n(n 1)
1 2 3 . . . n .
b. 2
1
13 2 3 33 . . . n 3 n 2 (n 1) 2 .
c. 4
2
d. 1 3 5 . . . (2n 1) n .
1 1 1 1 n
. . . .
e. 1.2 2.3 3.4 n(n 1) n 1
25
f. Use the principle of mathematical induction to prove the statement
𝑃𝑛 : 2 + 4 + 6 + 8 + ⋯ + 2𝑛 = 𝑛 + 𝑛2
for all natural numbers, 𝑛.
Proof.
𝑃𝑘 : 2 + 4 + 6 + 8 + ⋯ + 2𝑘 = 𝑘 + 𝑘 2 ….. (i)
Step 3:Now, show that the statement 𝑃𝑘+1 is true. That is, we must show
2 + 4 + 6 + 8 + ⋯ + 2𝑘 + 2(𝑘 + 1) = (𝑘 + 𝑘 2 ) + 2(𝑘 + 1)
= 𝑘(𝑘 + 1) + 2(𝑘 + 1)
= (𝑘 + 1)(𝑘 + 2)
= (𝑘 + 1)(𝑘 + 1) + 1)
= (𝑘 + 1)(𝑘 + 1) + (𝑘 + 1)(1)
= (𝑘 + 1)2 + (𝑘 + 1)
= (𝑘 + 1) + (𝑘 + 1)2 .
26