Professional Documents
Culture Documents
Discretenew
Discretenew
Contents
1 Mathematical Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 What is Logic? 1
1.2 Propositions 1
1.4 Connectives 2
1.7 Tautology 8
1.8 Contradiction 8
1 Mathematical Logic
1.1 What is Logic?
Logic may be defined as the science of reasoning. But logic is not an empirical
(i.e., experimental or observational) science like Physics, Biology, or Psychology.
Rather, logic is a non-empirical science like Mathematics. Logic provides rules
and techniques for determining whether a reasoning is valid or not. Logical
arguments are the essence of Mathematics. Logical methods are used to
prove theorems in Mathematics. In Computer Science, they are used to verify
the correctness of programs. In Natural Science and Physical Science, they
are used to draw conclusions from experiments. One component of logic is
Propositional Calculus.
1.2 Propositions
A declarative sentence that is either true or false is called a proposition or a
statement.
A proposition which cannot be further broken into simpler propositions is called
atomic proposition or simple proposition.
A proposition has two possible values called truth values. The two truth values
are true and false. They are denoted by T and F. These values are also denoted
by 1 and 0.
Illustration 1.1 1. 4 + 7 = 9
4. It is raining.
5. I am hungry.
2 Mathematical Logic
6. God exists.
The truth value of (1) is false and the truth values of (2) and (3) are true.
Illustration 1.2
Illustration 1.3
The following are not propositions.
2. x+4=7. (x is unknown)
1.4 Connectives
The words and phrases used to combine two or more simple propositions are
called connectives.
1.5 Important Connectives 3
1.5.1 Conjunction
Let p and q be two propositions. The conjunction of p and q is denoted by p ∧ q.
It is read as p and q. The conjunction is formed by combining the propositions
using the connective ‘and’. p ∧ q has a truth value T whenever both p and q
have a truth value T. In other cases it has a truth value F.
The truth table for p ∧ q is shown in the Table 1.1.
p q p∧q
T T T
T F F
F T F
F F F
3. p: 2 is an even integer.
q: 4 is an even integer.
p ∧ q 2 is an even integer and 4 is an even integer.
1.5.2 Disjunction
Let p and q be two propositions. The disjunction of p and q is denoted by p ∨ q.
It is read as p or q. The disjunction is formed by combining the propositions
4 Mathematical Logic
using the connective ‘or’. p ∨ q has a truth value F whenever both p and q have
a truth value F. In other cases it has a truth value T.
The truth table for p ∨ q is shown in the Table 1.2.
p q p∨q
T T T
T F T
F T T
F F F
3. p: 2 is an even integer.
q: 4 is an even integer.
p ∨ q: 2 is an even integer or 4 is an even integer.
1.5.3 Negation
Let p be a proposition. The negation of p is not the case of p. It is denoted by
∼ p or ¬p. It is read as negation of p. The truth table for ¬p is shown in the
Table 1.3.
Illustration 1.6 1. p : I am rich.
¬p : I am not rich.
Or
¬p : It is not the case that I am rich.
p ¬p
T F
F T
Or
¬p : It is not the case that I will drive my car.
3. p : 2 + 7 > 7
¬p :2 + 7 ≤ 7.
1.5.4 Implication
Let p and q be two propositions. p and q can be combined to form ‘if p then q’.
Such a statement is called implication. The implication of p and q is denoted by
p → q. It is read as ‘p implies q’. p → q has a truth value F when p has a truth
value T and q has a truth value F. In other cases it has a truth value T.
The truth table for p → q is shown in the Table 1.4.
3. p: 2 is an even integer.
q: 4 is an even integer.
p q p→q
T T T
T F F
F T T
F F T
• If p, then q
• If p, q
• p implies q
• p only if q
• q if p
• p is sufficient for q
• q is necessary for q
1.5.5 Biconditional
Two propositions p and q can be combined using the connective ‘if and only if’.
The statement thus formed is called biconditional statement. It is writern as
p ↔ q The statement p ↔ q is true if both p and q have the same truth value. In
all other cases it has a truth value F.
3. p: 2 is an even integer.
q: 4 is an even integer.
p ↔ q: 2 is an even integer if and only if 4 is an even integer.
(a) ¬(p ∧ q)
(b) ¬(p ∨ q)
(c) p → (p ∧ q)
1.7 Tautology
A statement formula which is always true, regardless of the truth value of its
components, is called a tautology.
Illustration 1.9
p ∨ ¬p is a tautology.
Illustration 1.10
(p ∨ q) ∨ ¬p is a tautology. (p ∨ q) ∨ ¬p is always true regardless of the truth
value of its components. So it is a tautology.
1.8 Contradiction
A statement formula which is always false, regardless of the truth values of its
components, is called a contradiction.
Illustration 1.11
p ∧ ¬p is a contradiction.
Illustration 1.12
(¬q ∧ p) ∧ q is a contradiction (¬q ∧ p) ∧ q is always false. So (¬q ∧ p) ∧ q is a
contradiction.
p ¬p p ∨ ¬p
T F T
F T T
p q (p ∨ q) ¬p (p ∨ q) ∨ ¬p
T T T F T
T F T F T
F T T T T
F F F T T
p ¬p p ∧ ¬p
T F F
F T F
p q ¬q ¬q ∧ p (¬q ∧ p) ∧ q
T T F F F
T F T T F
F T F F F
F F T F F
Illustration 1.13
¬(p ∨ q) ⇔ ¬p ∧ ¬q
¬(p ∨ q) and ¬p ∧ ¬q have the same truth value. so ¬(p ∨ q) ⇔ ¬p ∧ ¬q
Equivalent formulas:
1. Idempotent Laws
• p∨p ⇔ p
• p∧p ⇔ p
2. Associate laws
• (p ∨ q) ∨ r ⇔ p ∨ (q ∨ r)
• (p ∧ q) ∧ r ⇔ p ∧ (q ∧ r)
3. Commutative laws
• p∨q ⇔ q∨p
• p∧q ⇔ q∧p
4. Distributive laws
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 F F T F
• p ∨ (q ∧ r) ⇔ (p ∨ q) ∧ (p ∨ r)
• p ∧ (q ∨ r) ⇔ (p ∧ q) ∨ (p ∧ r)
5. Absorption laws
• p ∨ F ⇔ p, p ∧ F ⇔ F
• p∨T ⇔ T, p∧T ⇔ p
6. Demorgan’s laws
• ¬(p ∨ q) ⇔ ¬p ∧ ¬q
• ¬(p ∧ q) ⇔ ¬p ∨ ¬q
Illustration 1.14
show that p → (q → r) ⇔ p → (¬q ∨ r) ⇔ (p ∧ q) → r.
Solution :
q → r ⇔ ¬q ∨ r
p → (q → r) ⇔ ¬p ∨ (¬q ∨ r)
⇔ (¬p ∨ ¬q) ∨ r
⇔ ¬(p ∧ q) → r
Illustration 1.15
Show that (¬p ∧ (¬q ∧ r)) ∨ (q ∧ r) ∨ (p ∧ r) ⇔ r
Solution :
(q ∧ r) ∨ (p ∧ r) ⇔ (q ∨ p) ∧ r Using Distributive law.
12 Mathematical Logic
3. (p ∧ q) ∨ T . The dual is (p ∨ q) ∧ F
Theorem 1.1
Let A and A∗ be dual formulae. If p1 , p2 , . . . , pn are all atomic variables that occur
in A and A∗ , then
Proof :
¬(p1 ∨ p2 ∨ . . . ∨ pn ) ⇔ (¬p1 ∧ ¬p2 ∧ . . . ∧ ¬pn )
Similarly,
Illustration 1.17
Prove that p ∧ q ⇒ p
(p ∧ q) → p is a tautology. Therefore (p ∧ q) ⇒ p
14 Mathematical Logic
p q p∧q (p ∧ q) → p
T T T T
T F F T
F T F T
F F F T
Illustration 1.18
1. Prove (p ∧ q) ⇒ (p → q)
The antecedent is p ∧ q. Assume p ∧ q is true. Both p and q are true. If p
and q are true, then p → q is true. Therefore (p ∧ q) ⇒ (p → q)
Tautological Implications
1. p ∧ q ⇒ p
2. p ∧ q ⇒ q
3. p ⇒ p ∨ q
4. ¬p ⇒ p → q
5. q ⇒ p → q
6. ¬(p → q) ⇒ p
1.12 Inverse, Converse and Contrapositive 15
7. ¬(p → q) ⇒ ¬q
8. p ∧ (p → q) ⇒ q
9. ¬q ∧ (p → q) ⇒ ¬p
10. ¬p ∧ (p ∨ q) ⇒ q
11. (p → q) ∧ (q → r) ⇒ p → r
12. (p ∨ q) ∧ (p → r) ∧ (q → r) ⇒ r
2. p: 2 is an even integer
q: 4 is an even integer
p → q: If 2 is an even integer then 4 is an even integer.
Converse: q → p: If 4 is an even integer then 2 is an even integer.
Inverse: ¬p → ¬q: If 2 is not an even integer then 4 is not an even integer.
Contrapositive: ¬q → ¬p: If 4 is not an even integer, then 2 is not an even
integer.
16 Mathematical Logic
1.13.1 Exclusive OR
Let p and q be any two statement formulas. Then p and q can be combined
¯ It has a truth value
using the connective exclusive OR. This is denoted by p∨q.
T whenever either p or q but not both have a truth value T .
1.13.2 NAND
The connective NAND is a combination of NOT and AND. Here NOT is for
negation and AND is for conjunction. It is denoted by ↑.
p ↑ q = ¬(p ∧ q)
1.13.3 NOR
NOR is the combination of NOT and OR. It is denoted by ↓
p ↓ q = ¬(p ∨ q)
Illustration 1.20
Prove that the set F = {¬, ∨} is a functionally complete set of connectives.
Solution :
To prove that F is functionally complete set, we have to express all other
connectives in terms of the connectives in the set.
1. p ∧ q
p ∧ q ⇔ ¬¬(p ∧ q)
⇔ ¬(¬p ∨ ¬q)
2. p → q
p → q ⇔ ¬p ∨ q)
3. p ↔ q
p ↔ q ⇔ (p → q) ∧ (q → p)
⇔ (¬p ∨ q) ∧ (¬q ∨ p)
⇔ ¬¬((¬p ∨ q) ∧ (¬q ∨ p))
⇔ ¬(¬(¬p ∨ q) ∨ ¬(¬q ∨ p))
¯
4. p∨q
¯
p∨q ⇔ ¬(p ↔ q)
↔ ¬(¬(¬(¬p ∨ q)) ∨ ¬(¬q ∨ p))
18 Mathematical Logic
5. p ↑ q
p ↑ q ⇔ ¬(p ∧ q)
⇔ ¬p ∨ ¬q
6. q ↓ q
p ↓ q ⇔ ¬(p ∨ q)
We are able to express every other connectives in its equivalent form using
the connectives from the given set F. So the set F = {¬, ∨} is a functionally
complete set.
Illustration 1.21
Write the implications of the following propositions:
1. a p: There is flood.
q: The crops will be destroyed.
Solution :
p → q: If there is flood then the corps will be destroyed.
b p Ramu is rich.
q: Ramu is happy.
Solution :
p → q: If Ramu is rich then Ramu is happy.
1.14 Two-state Devices and Statement of Logic 19
Illustration 1.22
Which of the following are propositions?
Solution :
(a), (c) and (e) are statements (b) and (d) are not statements.
Illustration 1.23
Construct the truth table for (p ∨ q) ∧ (q ∨ r)
Solution :
The truth table for (p ∨ q) ∧ (q ∨ r)
Illustration 1.24
Write the negation of each of the following.
(a) 2 + 7 ≤ 11
Solution :
(a) 2 + 7 > 11
p q r p∨q q∨r (p ∨ q) ∧ (q ∨ r)
T T T T T T
T T F T T T
T F T T T T
F T T T T T
T F F T F F
F F T F T F
F T F T T T
F F F F F F
p → q ⇔ ¬p ∨ q
¬(p → q) ⇔ ¬(¬p ∨ q)
⇔ p ∧ ¬q
Illustration 1.25
Write the negation of each of the following.
(c) x + y = 6 or 2x + 3y < 3.
Solution :
(b) a2 + b2 , c2 or a ≤ 0.
(c) x + y , 6 and 2x + 3y ≥ 3.
1.14 Two-state Devices and Statement of Logic 21
Illustration 1.26
Construct the truth table for ¬(p ∧ q) ↔ (¬p ∨ ¬q).
Solution :
Let x = ¬(p ∧ q) ↔ (¬p ∨ ¬q).
Illustration 1.27
Construct the truth table for (q → p) → (p ∨ q).
Solution :
Illustration 1.28
Assuming p is true, q is false and r is true, find the truth value of each of the
following
1. (p ∧ q) → r
2. (p ∨ q) → r
3. p ∧ (q → r)
4. p → (q → r)
Solution :
p = T , q = F, r = T
1. (p ∧ q) → r
Since p is true and q is false p∧q is false, r is true. Therefore (p∧q) →
r is true.
p q p ∧ q ¬(p ∧ q) ¬p ¬q ¬p ∨ ¬q x
T T T F F F F T
T F F T F T T T
F T F T T F T T
F F F T T T T T
p q q→p (p ∨ q) (q → p) → (p ∨ q)
T T T T T
T F T T T
F T F T T
F F T F F
Illustration 1.29
Assuming p and r are false and that of q and s are true, find the truth value of
the each of the following propositions:
1. (s → (p ∧ ¬r)) ∧ (p → (r ∨ q)) ∧ s
Solution :
p = F, r = F, q = T , s = t
1. ¬r is true.
(p ∧ ¬r) has a truth value F.
s → (p ∧ ¬r) has a truth value F. Therefore the given expression (s →
(p ∧ ¬r)) ∧ (p → (r ∨ q)) ∧ s has the truth value F.
Illustration 1.30
p: It is below freezing point, and q: It is snowing. What ate the following
statements in symbolic form?
4. ‘It is below freezing point’ is the necessary and sufficient condition for it
to be snowing.
Solution :
1. p ∧ q
2. ¬p ∧ ¬q
3. p ∨ q
4. p → q
Illustration 1.31
Formulate the following symbolic expressions in words using
p: Today is Monday.
q: It is raining.
r: It is hot.
1. p ∨ q
2. ¬p ∧ (q ∨ r)
3. ¬(p ∨ q) ∧ r
Solution :
24 Mathematical Logic
Illustration 1.32
p: It is below freezing point and q: It is snowing. What ate the following
statements in symbolic form?
4. ‘It is below freezing point’ is the necessary and sufficient condition for it
to be snowing.
Solution :
1. p ∧ q
2. ¬p ∧ ¬q
3. p ∨ q
4. p → q
Illustration 1.33
Formulate the following symbolic expressions in words using
p: Today is Monday.
q: It is raining.
r: It is hot.
1. p ∨ q
2. ¬p ∧ (q ∨ r)
1.14 Two-state Devices and Statement of Logic 25
3. ¬(p ∨ q) ∧ r
Solution :
Illustration 1.34
Indicate which ones are tautologies or contradiction:
(a) (p → ¬q) → ¬p
(b) p → (p ∨ q)
(c) p → (q → p)
Solution :
(b) p → (p ∨ q) is a tautology.
(c) p → (q → p) is a tautology.
Illustration 1.35
Show that the following statements are true.
p q p∨q p → (p ∨ q)
T T T T
T F T T
F T T T
F F F T
p q q→p p → (q → p)
T F T T
T T T T
F T F T
F F T T
Solution :
:
Illustration 1.36
Without using truth table prove
p → (q → p) ⇔ ¬p → (p → q).
p q p∨q ¬p ¬q ¬(p ∨ q) ¬p ∧ ¬q x
T T T F F F F T
T F T F T F F T
F T T T F F F T
F F F T T T T T
p q p∧q ¬p ¬q ¬(p ∧ q) ¬p ∨ ¬q x
T T F F F F F T
T F F F T T T T
F T F T F T T T
F F F T T T T T
p q p→q ¬p ¬p ∨ q (p → q) ↔ (¬p ∨ q)
T T F T T T
T F F F F T
F T T T T T
F F T T T T
p → (q → p) ⇔ ¬p ∨ (¬q ∨ p)
⇔ ¬p ∨ ¬q ∨ p
⇔ (¬p ∨ p) ∨ ¬q
⇔ T ∨ ¬q (¬p ∨ p = T )
⇔ T. (T ∨ p = T ) (1.1)
Also, ¬p → (p → q) ⇔ ¬¬p ∨ (¬p ∨ q)
⇔ p ∨ ¬p ∨ q
⇔ (p ∨ ¬p) ∨ q
⇔ T ∨ ¬q
⇔ T (1.2)
Illustration 1.37
With out using truth table prove that
p → (q ∨ r) ⇔ (p → q) ∨ (¬p ∨ r)
28 Mathematical Logic
Solution :
p → (q ∨ r) ⇔ ¬p ∨ (q ∨ r)(p → q = ¬p ∨ q)
⇔ ¬p ∨ q ∨ r (1.3)
(p → q) ∨ (¬p ∨ r) ⇔ (¬p ∨ q) ∨ (¬p ∨ r) (1.4)
⇔ (¬p ∨ ¬p) ∨ (q ∨ r) (Associative rule)
⇔ ¬p ∨ q ∨ r(p ∨ p ⇔ p) (1.5)
Illustration 1.38
Prove that q ⇒ (p → q)
Solution :
Method 1: Using truth table.
To prove q ⇒ (p → q) we have to prove q → (p → q) is a tautology. q → (p →
q) is a tautology. Therefore q ⇒ (p → q)
p q p→q q → (p → q)
T T T T
T F F T
F T T T
F F T T