Professional Documents
Culture Documents
MFCS Unit 1
MFCS Unit 1
Science
B. Tech II Year I Sem
M. RAMA
2
Syllabus
UNIT-I
Mathematical Logic: Statements and notations, Connectives, Well formed formulas, Truth
Tables, tautology, equivalence implication, Normal forms.
Predicates:Predicative logic, Free & Bound variables, Rules of inference, Consistency, proof
of contradiction, Automatic Theorem Proving.
UNIT-II
Relations: Properties of binary Relations, equivalence, transitiveclosure, compatibility and
partial ordering relations.
Functions: Inverse Function, Composition of functions,recursive Functions, Lattice and its
Properties.
M. RAMA
UNIT-III
Elementary Combinatorics: Basis of counting, Combinations & Permutations, with repetitions,
Constrained repetitions, Binomial Coefficients, Binomial Multinomial theorems, the principles of
Inclusion -Exclusion. Pigeon hole principles and its application.
UNIT-IV
Recurrence Relation: Generating Functions, Function of Sequences Calculating Co-efficient of
generating function, Recurrence relations, Solving recurrence relation by substitution and
Generating functions. Characteristics roots solution of In- homogeneous Recurrence Relation.
UNIT-V
Graph Theory: Basic Concepts, Isomorphisms and Subgraphs, Trees and Their Properties Spanning
Trees, B.F.S,D.F.S. Directed Trees, Binary Trees, Planar Graphs, Euler’s Formula, Multigraphs and
Euler Circuits, Hamiltonian Graphs, Chromatic Numbers, The Four-ColorProblem.
M. RAMA
TEXT BOOKS:
1. Discrete Mathematical Structures with Applications to Computer Science-J. P.Tremblay
R. Manoharn, Tata McGraw Hill.
2. Discrete mathematics for computer scientists & mathematicians JL Mott, A Kandel,
T. P.Baker PHI.
REFERENCE BOOKS:
1. Discrete Mathematics and its Applications, Kenneth H.Rosen, Fifth Edition.TMH.
2. Discrete Mathematical Structures Theory and application-Malik & Sen, Cengage.
3. Discrete Mathematics with Applications, Thomas Koshy, Elsevier.
4. Logic and Discrete Mathematics, Grass Man & Trembley, Pearson Education.
5. Mathematical Foundations of Computer science, 3rd Edition, Dr. D.S.C.
M. RAMA
UNIT – I
Mathematical Logic: Statements and notations, Connectives, Well formed
formulas, Truth Tables, tautology, equivalence implication, Normal forms.
M. RAMA
Mathematical logic
Proposition :
A proposition is a declarative sentence which is either true or false
but not both.
M. RAMA
7
contd…
• Propositions are also called as Statements.
• The truth or falsity of a proposition is called its truth-value.
• These two values true and false are denoted by the symbols T and F
respectively.
• Sometimes these are also denoted by the symbols 1 and 0 respectively.
•Propositions are usually represented by small letters such as p, q, r, s, ..
Ex:
p: 14 is divisible by 7.
q: India had a woman Prime minister.
M. RAMA
8
Examples:
x+2 is a positive number
What is your name?
5 divides x
x+y=z
These are not propositions as they are not declarative in nature, that is,
they do not declare a definite truth value T orF.
M. RAMA
9
Atomic and Compound statements
Atomic statement : A statement which can not be divided further, is called
atomic statement.
These statements are also called as Simple statements or primary statements.
2+3 = 5
M. RAMA
10
Compound Statement :
Two or more simple statements can be combined to form a new statement.
These new statements are called as Compound statements or Molecular
Statements or Propositional function or Statement formulas.
Compound statements can be formed from atomic statements through
the use of following words or phrases. Such words or phrases are called
Logical Connectives.
‘not’, ‘and', ‘or', ‘if …then‘ and ‘if and only if ‘ are called connectives.
Ex: It is raining today and there are 20 tables in this room.
Note: Propositions which do not contain any logical connective are called
Simple propositions.
M. RAMA 1
1
Logical Connectives
Basic connectives:
• Negation
• Conjunction
• Disjunction
• Conditional
• Biconditional
• Exclusive Disjunction.
M. RAMA
12
Representations and Meanings of Logical Connectives
1 Negation ~P “not p”
2 Conjunction P Q “P and Q”
3 Disjunction P VQ “P or Q ”
4 Conditional P →Q “if P then Q”
5 Biconditional P ↔Q “P if and only if Q”
6 Exclusive P ⊻Q “Either P or Q”
Disjunction
M. RAMA
Negation:
If p is a statement, then the negation of p, written as ~p and read as “ not p”
is a statement.
Example 1: Example 2:
p : London is a city. q : 2+3=5
~p : London is not a city. ~q : ?
2+3=5
The truth table forNegation is given below.
P ~P P ~P
T F 1 0
F T 0 1
M. RAMA 11
Conjunction (and) pq
• A compound proposition obtained by combining two given propositions by
inserting the word ‘and’ in between them is called the conjunction of the given
proposition.
• If p and q are two propositions, then the conjunction of p and q is the statement
p q which is read as “ p and q ”.
• The statement p q has the truth value T whenever both p and q have truth value T,
otherwise it has the truth value false.
p q pq
F F F
F T F
T F F
T T T
15
M. RAMA
Example:
p: 3 is a prime number
q: All triangles are equilateral
r: 2+5=7
a) p is a true proposition
b) q is a false proposition
c)r is a true proposition
Find
p q : 3 is a prime number and All triangles are equilateral
p r : 3 is a prime number and 2+5=7
q r : All triangles are equilateral and 2+5=7
According to truth table p q is false, p r is true and q r is false.
M. RAMA 16
Truth values:
pq:
p q pq
T F F
pr:
p r pr
T T T
qr:
q r qr
F T F
M. RAMA
Disjunction ( or ) pvq
• Inserting ‘or’ in between two propositions is called disjunction.
• If p and q are two propositions, then the disjunction of p and q is the statement
pq which is read as “ p orq”.
• The statement pq has the truth value F only when both p and q have truth
value F; Otherwise it has the truth value T.
p q pq
F F F
F T T
T F T
T T T
18
M. RAMA
Example:
p: 3 is a prime number
q: All triangles are equilateral
s: 2+5=7
a) p is a true proposition
b) q is a false proposition
c)s is a true proposition
Find
p q : 3 is a prime number or All triangles areequilateral
p s : 3 is a prime number or 2+5=7
q s : All triangles are equilateral or 2+5=7
According to truth table p q is true, p s is true and q s is true
19
M. RAMA
Truth values:
pq:
p q pq
T F T
p r:
p r pr
T T T
q r:
q r qr
F T T
M. RAMA
Conditional (Implies) pq
If p and q are two propositions, then the statement p q which is read as
“ if p, then q ” or “ p implies q “.
The statement p q has truth value F only when p is true and q is false;
otherwise it has a truth value T.
p q pq
F F T
F T T
T F F
T T T
M. RAMA
21
Example:
1) P : It rains.
Q: The crop will grow.
The implication P → Q states that
R: If it rains then the crop will grow.
2) P : I will go to Australia.
Q: I will earn more money.
The implication P → Q states that
R: If I will go to Australia, then I will earn more money.
M. RAMA
Example:
p: 2 is a prime number
q: 3 is a prime number
r : 6 is a perfect square
s: 9 is a multiple of 6
here,
p and q are true propositions
r and s are false propositions
Find
pq: if 2 is a prime number, then 3 is a prime number, truth value 1
pr: if 2 is a prime number, then 6 is a perfect square, truth value 0
rq: if 6 is a perfect square, then 3 is a prime number, truth value 1
rs: if 6 is a perfect square, then 9 is a multiple of 6, truth value 1
M. RAMA
23
Truth values:
p q:
p q pq
T T T
pr:
p r pr
T F F
M. RAMA
Biconditional (Bi-implies) pq
If p and q are two propositions, then the conjunction of p q and q pis
called biconditional of p and q. It is denoted by p q, which is read as
“ if p then q and if q then p or p if and only if q ”.
The statement p q has the truth value T whenever both p and q have
identical truth values.
Note: p q is same as (p q) (q p)
p q pq
F F T
F T F
T F F
T T T
25
M. RAMA
1) P : He goes to play a match
Q : it does not rain.
The P Q states that
R: He goes to play a match if and only if it does not rain.
2) P : Birds fly
Q : sky is clear
The P Q states that
R : Birds fly if and only if sky is clear.
M. RAMA
Exclusive Disjunction(⊕ / ⊻) or ExclusiveOR :
Let p and q are 2 propositions. The exclusive or of p and q, denoted by
p ⊕ q, is the proposition that is true when exactly one of p and q is
true and is false otherwise.
p q p⊻ q
F F F
F T T
T F T
T T F
M. RAMA
Example:
p: 8 is prime number
q: 2+3=5
(4)There is no cricket telecast this evening but Ravi does not study and does not visit a friend
this evening. (¬ r ∧ (¬q∧¬p))
Exercises:
1) Find conjunction and disjunction of following propositionsand
indicate truth value
p: 4 is a perfect square
q: 5 is divisible by 2
r : 27 is prime number
s: 7 is a multiple of 3
2) Determine the truth value
a. pq is false and p is true, find the truth value of q
b. pq is false and q is false, find the truth value of p
c. pq is true and p is false, find the truth value of q
d. p q is true and p is false, find the truth value of q
M. RAMA
30
Well formed formulas:
While representing a statement involving connectives in symbolic form, care has
to be taken to ensure that the symbolic representation convey the intended
meaning of the statement without any ambiguity .
M. RAMA
31
Example-1:
The negation of the conjunction of the propositions p and q.
¬p∧q // wrong
¬ (p ∧ q) // correct
Example-2: “If p and q ,then r” involving the propositions p, q,r
p∧q →r // wrong
(p∧q)→r // correct
Wffs are constructed using the followingrules:
Ex-2: PQ ,
(PQ )Q ) and
(P Q ) (Q) are
not well formed formulas.
M. RAMA
non-WFF explanation
P Q Q P Q
F F T T
F T F F
T F T T
T T F T
38
Truth Tables - Examples
Ex – 2: Construct the truth table for (PQ) P
F F F T T
F T T T T
T F T F T
T T T F T
M. RAMA 39
Exercises:
4
M. RAMA
0
1) Construct the truth table for p q v p)
p q qvp p (q v p)
F F F F
F T T F
T F T T
T T T T
2) Construct the truth table for (p v q) (~p)
F F F F T T F
F F T F F F T
F T F F T T F
F T T F F F T
T F F F T T T
T F T F F F F
T T F T T T T
T T T T F T T
M. RAMA 43
PART - 2
Tautology
Contradiction
Contingency
Logical Equivalence
Laws of Logic
Tautology and Contradiction
Tautology :
A compound proposition which is true for all possible truth values
of its components is called a Tautology ( A Universally valid formula or a
logical truth). A tautology is generally denoted by T0.
45
Contradiction (Absurdity): A compound proposition which is false for all
possible truth values of its components is called a Contradiction.
Ex-1: P P is a Contradiction.
P P P P
F T F
T F F
Ex-2: ( P P ) Q is a Contradiction
P Q P P P ( P P ) Q
F F T F F
F T T F F
T F F F F
T T F F F
Contingency:
A compound proposition that can be true or false is
called a Contingency. In other words, a contingency is a compound proposition
which is neither a tautology or contradiction.
Ex. PQ, PQ, PQ, ….
1. PVQ
P Q PVQ
F F F
F T T
T F T
T T T
Exercises:
Prove that the following are tautologies
1. (p v q) v ~p
2. [(p q) (q r)] (p r)
3. [ (p q) (p ~q)] ~q
4. (PQ)(Q)
5. ~(p v q) v [(~p) q] v p
Prove that [(p q) (q r)] (p r) is a tautology
Truth table
F F F T T T T T
F F T T T T T T
F T F T F F T T
F T T T T T T T
T F F F F F F T
T F T F F F T T
T T F T F F F T
T T T T T T T T
Ex-4: Using truth tables, show that (PQ)(Q) is a
tautology
P Q P Q ( P Q ) Q ( P Q ) (Q)
F F T F T T
F T T F F T
T F F T T T
T T T F F T
M. RAMA
50
Logical Equivalence
Two propositions P and Q are logically equivalent, if they have same truth values.
Then we write P Q (or) P Q
Ex: (P ) P
Ex: ( P Q ) ( P Q ).
p q P→Q ¬P ¬P ∨ Q (P → Q) ↔(¬P ∨ Q)
0 0 1 1 1 1
0 1 1 1 1 1
1 0 0 0 0 1
1 1 1 0 1 1
52
Logical Equivalence
Example 1: Let x be a specified positive integer . Consider the following propositions
p: x is an odd integer q: x is not divisible by 2
Are p and q logically equivalent?
Ans: p and q have identical truth values. As such p and q are logically equivalent
Method I. Truth Table Method: One method to determine whether any two statement formulas
are equivalent is to construct their truth tables.
T T T F F F T T
T F T F T F T T
F T T T F F T T
F F F T T T F 53 T
Examples:
Ex-1: Show that ( P Q ) (P ) Q
P Q PQ P P)Q
F F T T T
F T T T T
T F F F F
T T T F T
M. RAMA 54
Ex-2: Prove that (PQ) (Q P)
M. RAMA 55
Exercises:
(a)P ∨ P ⇔ P (b) P ∧ P ⇔ P
3. Identity Laws:
4. Inverse Laws:
(a) (P ∨ ~ P)⇔ T0 (b) (P ∧ ~ P )⇔ F0
5. Domination Laws:
(a) (P ∨ T0)⇔ T0 (b) (P ∧ F0)⇔ F0
6. Commutative laws:
(a) (P ∨ Q) ⇔ (Q ∨ P) (b) (P ∧ Q) ⇔ (Q ∧ P)
7. Absorption laws:
(a) [P ∨ (P ∧ Q) ]⇔ P (b) [P ∧ (P ∨ Q) ]⇔ P
8. DeMorgan laws:
(a) ¬(P ∨ Q) ⇔ ¬P ∧ ¬Q (b) ¬(P ∧ Q) ⇔ ¬P ∨ ¬Q
9. Associative laws:
(a) P ∨ (Q∨ R) ⇔ (P ∨ Q) ∨ R
(b) P ∧ (Q∧ R) ⇔ (P ∧ Q )∧ R
Proof:
L.H.S = P (Q R)
P (Q R) (Since p q ( p q))
P (Q R)
P (Q R)
(P Q) R (By using associative law)
( P Q ) R (By using demorgan law)
P Q
( P Q ) R
= R.H.S
M. RAMA 60
Ex. Without using truth tables, Show that ( P Q ) P is a tautology.
Proof:
Consider, (P Q ) P
(P Q ) P
( Q P ) P ( By commutative law )
Q ( P P ) ( By associative law)
Q T ( By inverse law)
T ( By domination law)
( P Q ) P is a tautology.
M. RAMA 61
Ex. Show that the Statement formula ( P Q ) (PQ) P is a tautology.
Proof :
Consider, {( P Q ) (PQ)} P
{(P Q ) (PQ)} P (Demorgan’s law)
{P (Q Q)}P (Inverse law)
{P T } P (Distributive law)
{P } P (Identity law)
T (Inverse law)
( P Q ) (PQ) P is a tautology
M. RAMA 62
Ex. Show that [{( P Q ) ( P Q )} R ] R
Proof: L.H.S = {( P Q ) ( P Q )} R
{( P Q ) ( P Q )} R (Since P Q ( P Q))
PP ( P P ( P P) )
{ ( P Q ) ( P Q )} R
P V P (By using Inverse law- (Pv~P) T)
{T}R
R (By using Identity law- (P T) P)
= R.H.S
M. RAMA 63
Ex. Show that {( P Q ) ( P Q )} is a Contradiction.
Proof : Consider,
{( P Q ) ( P Q )} Let P Q = R
{ R R }
F
{ ( P Q ) ( P Q )} is a contradiction.
Ex. Show that (P (Q R)) ( Q R ) (P R) R
Proof : Consider,
{P (Q R)} ( Q R ) (P R)
{ (P Q) (Q P ) } R,
R
M. RAMA 65
Ex. S.T. [(P Q) {P (Q R)}] ( P Q) (P R) is a
tautology.
Consider,
[(P Q) {P (Q R)}] {(P Q) (P R)}
[(P Q) {P (Q R)}] {(P Q) (P R)} (By Demorgan laws)
[(P Q) {P (Q R)}] {(P Q) (P R)}
[(P Q) {(P Q) (P R)} ] {(P Q) (P R)} (By Distributive law)
[(P Q) (P Q) (P R)] {(P Q) (P R)} (By Distributive law)
P P (Since p p p)
{(P Q) (P R)} {(P Q) (P R)}
P v ~P (By Inverse law p p T)
T
M. RAMA 66
Table
9 P V (Q R) (P V Q) (P V R) P (Q V R) (P Q) V (P R) Distributive Law
Simplify the following compound proposition using the laws of logic:
i) (p v q) [¬{(¬p) q}]
(p v q) p ¬q)]
2. 2<3 or 4<3
Solution:
2>=3 and 4>=3
Exercises:
3. Rewrite the following statements without using the conditional:
[Hint: ( p q ( p q) ) ]
a) If I dream of home, then I will work hard and earn money
I do not dream of home or I will work hard and earn money
Explanation:
p: It rains q: I do not drive the car
p q: If it rains then I do not drive the car
( p q ( p q) )
the negation of above statement is: It rains and I drive the car
[negation of p q is ~ ( p q) equal to ( p ∧ q) ]
Exercises:
5. Write down the negation of each of the following statements:
[Hint: ( p q ( p q) ) negation is (p ∧ ¬ q) ]
a) If I dream of home, then I will work hard and earn money
I dream of home and I will not work hard or will not earn money
b) If I am awake, then I will work on the computer or read a novel
I am awake, and I will not work on the computer and I will not read a novel
c) If I study mathematics and discrete structures, then I will not fail in the
examination.
I study mathematics and discrete structures, and I will fail in the examination.
Exercises:
6. Indicate the negation of the following compound propositions:
1) If an integer is greater than 2 and less than 4, then it is divisible by 3
2) (p v q) ∧ r
3) p → (q → r)
4) (p ∧ r) → (q v r)
5) (p v q) → r
6) (p ∧ q) → r
7) p → (¬ q ∧ r )
Solutions:
1. An integer is greater than 2 and less than 4, and it is not divisible by 3
2. (p v q) ∧ r (¬p ∧ ¬q) v ¬r
3. p → (q → r) p ∧ (q ∧ ¬ r)
4. (p ∧ r) → (q v r) (p ∧ r) ∧ (¬ q ∧ ¬ r)
5. (p v q) → r (p v q) ∧ ¬ r
6. (p ∧ q) → r (p ∧ q) ∧ ¬ r)
7. p → (¬ q ∧ r ) p ∧ (q v ¬ r)
Exercises:
1. Verify the Identity, Inverse and Domination laws through truth
tables.
2. Prove that DeMorgan law: ¬(P ∧ Q) ⇔ ¬P ∨ ¬Q
3. Prove that Distributive law: P ∧ (Q ∨ R) ⇔ (P ∧ Q) ∨ (P ∧ R)
PART-3
Transitive Rule
Substitution Rule
Duality Law
NAND and NOR connectives
Logical Implications
Tautological Implication
Transitive Rule: If u, v, w are prepositions such that u ⇔ v and v ⇔ w,
then u ⇔ w
Substitution Rule:
Solutions:
i) ¬(p ∧ q) v [p ∧ ¬ (q v ¬s)]
ii) (p v q) ∧ [(¬p ∧ q) v (¬r ∧ s)] ∧ (r v s)
Example-3 : Write down the duals of the following propositions
i) p → q
We recall that (p → q) ⇔ (¬p v q)
(p → q)d ⇔ (¬p v q)d
¬p ∧ q
ii) [(p → q) → r] d ⇔ [¬(p → q) v r] d
⇔ [¬(¬p v q) v r] d
⇔ [(p ∧ ¬q) v r] d
(p v ¬q) ∧ r
iii) [p → (q → r)] d ⇔ ¬p ∧ (¬q ∧ r)
Exercises:
Write down the duals of the following compound propositions:
1. q → p u = ¬q v p ud = ¬q ∧ p
2. (p v q) ∧ r ud = (p ∧ q) v r
3. (p ∧ q) v T ud = (p v q) ∧ F
4. p →(q ∧ r) u= ¬p v (q ∧ r) ud= ¬p ∧ (q v r)
5. p ↔ q u=(p →q) ∧ (q → p), u=(¬p v q) ∧ (¬q v p)
ud=(¬p ∧ q) v (¬q ∧ p)
6. p v q ud = ¬(p ↔ q) ud = (p v ¬q) ∧ (q v ¬p)
Example-4: Verify the principle of duality for the following logical equivalence
(a). ¬(P ∧ Q) → (¬P ∨ (¬P ∨ Q)) ⇔ (¬P ∨ Q)
Solution: u=¬(P ∧ Q) → (¬P ∨ (¬P ∨ Q)) and v= (¬P ∨ Q)
u= ¬ (¬(P ∧ Q)) ∨ (¬P ∨ (¬P ∨ Q)) [∵ P → Q ⇔ ¬P ∨ Q]
⇔ (P ∧ Q) ∨ (¬P ∨(¬P ∨ Q))
Therefore,
ud⇔ (P V Q) ∧ (¬P ∧ (¬P ∧ Q))
⇔ (P V Q) ∧ (¬P ∧ Q)
⇔ [(P ∧ (¬P ∧ Q)] ∨ [(Q ∧ (¬P ∧ Q)]
⇔ (F ∧ Q) ∨ (Q ∧ ¬P )
⇔ F V (Q ∧ ¬ P)
⇔ (¬P ∧ Q)
Also, vd ⇔ (¬P ∧ Q)
We observe that ud⇔ vd
Exercises:
∴ NOR is commutative.
(P ↓ Q) ⇔ (Q ↓ P )
NOR is not Associative:
Let P , Q and R be any three statement formulas.
Consider
P↓ (Q ↓ R) ⇔ ¬(P ∨ (Q ↓ R))
⇔ ¬(P ∨ (¬(Q ∨ R)))
⇔ ¬P ∧ (Q ∨ R)
(P ↓ Q) ↓ R ⇔ ¬(P ∨ Q) ↓ R
⇔ ¬(¬(P ∨ Q) ∨ R)
⇔ (P ∨ Q) ∧ ¬R
Therefore the connective ↓ is not associative.
Points:
i) NAND is commutative. (P ↑ Q) ⇔ (Q ↑ P )
ii) NAND is not associative.
iii) NOR is commutative. (P ↓ Q) ⇔ (Q ↓ P )
iv) NOR is not associative.
v) P ↑ Q and P ↓ Q are duals of each other.
Since
¬(P ∧ Q) ⇔ ¬P ∨ ¬Q
¬(P ∨ Q) ⇔ ¬P ∧ ¬Q.
Truth Table for (P ↑ Q) and (P ↓ Q)
P Q P↑Q P↓Q
0 0 1 1
0 1 1 0
1 0 1 0
1 1 0 0
Example: Show that (A ⊕ B) ∨ (A ↓ B) ⇔ (A ↑ B).
Solution: We prove this by constructing truth table.
Solutions:
i) For any proposition p, we have p ∧ p p and p v p p.
Therefore, ¬p ⇔ ¬(p ∧ p)
⇔ (p ↑ p)
Also, ¬p ⇔ ¬(p v p)
⇔ (p ↓ p)
ii) p ∧ q
p ∧ q ⇔ ¬[¬(p ∧ q)] [P ↑ Q ⇔ ¬(P ∧ Q)]
⇔ ¬ (p ↑ q) [¬p ⇔ (p ↑ p)]
⇔ (p ↑ q) ↑ (p ↑ q)
Also,
p ∧ q ⇔ ¬(¬p) ∧ ¬(¬ q)
⇔ ¬[(¬p) v (¬ q)] [(p ↓ q) ⇔ ¬(p v q)]
⇔(¬p) ↓ (¬q) [¬p ⇔ (p ↓ p)]
⇔ (p ↓ p) ↓ (q ↓ q)
iii) p v q
p v q ⇔ ¬(¬p) v ¬(¬ q)
⇔ ¬[(¬p) ∧ (¬ q)] [P ↑ Q ⇔ ¬(P ∧ Q)]
⇔ (¬p) ↑ (¬q) [¬p ⇔ (p ↑ p)]
⇔(p ↑ p) ↑ (q ↑ q)
Also,
p v q ⇔ ¬¬(p v q)
⇔ ¬[¬(p v q)] [(p ↓ q) ⇔ ¬(p v q)]
⇔ ¬ (p ↓ q) [¬p ⇔ (p ↓ p)]
⇔ (p ↓ q) ↓ (p ↓ q)
iv) p → q
p → q ⇔ ¬ ¬(p → q) [(p → q)⇔ (¬p v q)]
⇔ ¬[¬(¬p v q)]
⇔ ¬ (p ∧ ¬q) [P ↑ Q ⇔ ¬(P ∧ Q)]
⇔ p ↑(¬q) [¬p ⇔ (p ↑ p)]
⇔ p ↑(q ↑q)
Also,
p → q ⇔(¬p v q) [using above (iii) P∨ Q ⇔ (P ↓ Q) ↓ (P ↓ Q)]
⇔ (¬p ↓ q) ↓(¬p ↓ q),
⇔ [(p ↓ p) ↓ q)] ↓[(p ↓ p) ↓ q)
Exercises:
1. Prove that
a) (p ↑ q) ⇔ (q ↑ p)
b) (p ↓ q) ⇔ (q ↓ p)
2. Prove that [p→ (¬p→ q)] ⇔ [p ↑ (p ↓ q)]
3. Prove the following
a) (p ↑ q) ⇔ (¬p ∧ q)v (p ∧ ¬q) v (¬p ∧ ¬q)
b) (p ↓ q) ⇔ (¬p v q) ∧ (p v ¬q) ∧ (¬p v ¬q)
Logical Implication
M. RAMA 29
Converse: It is defined as interchanging the implication
Ex: The converse of p q is q p
Inverse (opposite): It is defined as the negation of the implication
Ex: The opposite of p q is p q
Contra positive : It is defined as the negation of converse of the original statement.
Ex: The contra positive of p q is q p
Consider a conditional p → q
1) q → p is called the Converse of p → q.
2) ¬p →¬q is called the inverse (or opposite) of p → q
3) ¬q →¬p is called the Contra positive of p → q
30
Example: p: 2 is an integer q: 9 is a multiple of 3
Then
p → q: If 2 is an integer then 9 is a multiple of 3.
Converse of this conditional is
q → p : if 9 is a multiple of 3 then 2 is an integer .
The inverse is
¬p →¬q: If 2 is not an integer then 9 is not a multiple of 3.
The Contrapositive is:
¬q →¬p: if 9 not is a multiple of 3 then 2 is not an integer
Truth table for Converse, Inverse and Contra positive
p q ¬p ¬q p → q q → p ¬p →¬q ¬q →¬p
0 0 1 1 1 1 1 1
0 1 1 0 1 0 0 1
1 0 0 1 0 1 1 0
1 1 0 0 1 1 1 1
32
Points:
1. A conditional & its contra positive are logically equivalent.
i.e., p q is logically equivalent to q p
denoted as p q q p (or) p q q p
2. The converse & inverse of a conditional are logically equivalent.
i.e., qp p q
3. (pq) and(qp) do not have same truth values in all situations.
i.e., (pq) (qp)
Ex: p: Today is Sunday q: Today is Holiday
• p q : If today is Sunday, then today is Holiday
•q p :If today is not Holiday, then today is not Sunday
If p q is true then it’s converse q p need not be true.
If p q is true then it’s opposite p q need not be true.
Example: Consider the statement
P : It rains.
Q: The crop will grow.
The implication P → Q states that
If it rains then the crop will grow.
The converse of the implication P → Q, namely Q → P states that
If the crop will grow then there has been rain.
The inverse of the implication P → Q, namely ¬P → ¬Q states that
If it does not rain then the crop will not grow.
The contrapositive of the implication P → Q, namely ¬Q → ¬P states that
If the crop do not grow then there has been no rain.
Exercises
Write converse ,inverse and contra positive for the following statements :
1) If P is a square, then Q is a rectangle
2) If c is rational, then the decimal expansion of r is repeating
3) If n is prime, then n is odd or n is 2
4) If x is non negative, then x is positive or x is 0
5) If Tom is Ann’s father, then Jim is her uncle and Sue is her aunt
6) If n is divisible by 6, then n is divisible by 2 and n is divisible by 3
7) If you drive, then you don’t drink.
8) If x2 is an even number, then x is an even number.
35
Tautological Implications
A statement formula p is said to tautologically imply a statement q if and only if
p→ q is a tautology
In this case we write p ⇒ q, which is read as ‘p implies q‘.
Note: ⇒ is not a connective, p ⇒ q is not a statement formula.
Clearly p ⇒ q guarantees that q has a truth value T whenever p has the truth
value T .
One can determine whether p ⇒ q by constructing the truth tables of p and q
in the same manner as was done in the determination of p ⇔ q.
36
Example: Prove that (P → Q) ⇒ (¬Q → ¬P ).
P Q ¬P ¬Q P→Q ¬Q → ¬P (P → Q) → (¬Q → ¬P )
T T F F T T T
T F F T F F T
F T T F T T T
F F T T T T T
Since all the entries in the last column are true, (P → Q) → (¬Q → ¬P ) is a
tautology.
Hence (P → Q) ⇒ (¬Q → ¬P ).
37
Show that [p ∧ (p → q)] ⇒q
p q p → q p ∧ (p → q) p ∧ (p → q) → q
0 0 1 0 1
0 1 1 0 1
1 0 0 0 1
1 1 1 1 1
Since all the entries in the last column are true, p ∧ (p → q) → q
is a tautology.
Hence [p ∧ (p → q)] ⇒q
38
Ex: S.T [p ∧ (p → q) ∧r] ⇒[(p ∨q) →r]
p q r p→q p ∨q p ∧ (p → q) ∧r (p ∨q) →r X→Y
0 0 0 1 0 0 1 1
0 0 1 1 0 0 1 1
0 1 0 1 1 0 0 1
0 1 1 1 1 0 1 1
1 0 0 0 1 0 0 1
1 0 1 0 1 0 1 1
1 1 0 1 1 0 0 1
1 1 1 1 1 1 1 1
39
Example: Prove that ¬Q ∧ (P → Q) ⇒ ¬P
Solution: Assume that the antecedent(L.H.S) ¬Q ∧ (P → Q) has the truth value T ,
then both ¬Q and P → Q have the truth value T ,
which means that Q has the truth value F , P → Q has the truth value T .
Hence P must have the truth value F .
Therefore the consequent ¬P must have the truth value T.
Truth Table for ¬Q ∧ (P → Q) ⇒ ¬P . ¬Q ∧ (P→Q) ¬Q ∧ (P →Q) → ¬P
P Q ¬P ¬Q P→Q
F F T T T T T
F T T F T F T
T F F T F F T
T T F F T F T
40
Another method to show: A ⇒ B is to assume that the consequent B
has the truth value F and then show that this assumption leads to A
having the truth value F . Then A → B must have the truth value T .
Example: Show that ¬(P → Q) ⇒ P .
Solution: Assume that P has the truth value F . When P has F , P → Q
has T , then ¬(P → Q) has F
Hence ¬(P → Q) → P has T .
¬(P → Q) ⇒ P
41
42
PART – 4
Normal Forms
1. Disjunctive Normal Form (DNF).
2. Conjunctive Normal Form (CNF).
3. Principal Disjunctive Normal Form (PDNF).
4. Principal Conjunctive Normal Form (PCNF).
Normal Forms
Let A(P1, P2, …, Pn) be a statement formula where P1, P2, …, Pn are the atomic
variables.
The truth table for A consists of truth values for A, for all possible assignments of
the truth values to P1, P2, …, Pn.
If the formula A have the truth value T for all possible combinations, then it is
called as identically true or tautology.
The truth value F for all possible combinations, then it is called as identically false
or contradiction.
The truth value T for at least one combination, then it is called as satisfiable.
A decision problem is a problem of determining, whether the given formula is a
tautology, contradiction or at least satisfiable in a finite number of steps.
The straight forward approach for determination is by constructing the truth
tables. But, it is tedious and complicate when there are many component
variables in the given formula.
The alternative procedure is reduce the given formula to normal forms.
It will be convenient to use the word “product” in place of “conjunction” and
“sum” in place of “disjunction” in our current discussion.
A product of the variables and their negations in a formula is called an
elementary product.
Ex: (P ∧ ¬P ), (P ∧ Q)
Similarly, a sum of the variables and their negations in a formula is called an
elementary sum.
Ex: (P ∨ P), (¬P ∨ Q)
There are four types of normal forms :
P↔Q ⇔ (P → Q) ∧ (Q → P)
⇔ (¬ P ∨ Q) ∧ (¬ Q ∨ P)
⇔ [(¬ P ∨ Q) ∧ ¬ Q ] ∨ [(¬ P ∨ Q) ∧ P] [Distributive Law]
⇔ (¬ P ∧ ¬ Q )∨ (Q ∧ ¬ Q ) ∨ (¬ P ∧ P )∨ (Q ∧ P)
⇔ (¬ P ∧ ¬ Q )∨ F ∨ F∨ (Q ∧ P) [Inverse law]
⇔ (¬ P ∧ ¬ Q ) ∨ F V (Q ∧ P)
⇔ (¬ P ∧ ¬ Q ) ∨ (Q ∧ P)
Ex-4: Find disjunctive normal form of the compound proposition
P →{(P →Q) ∧¬(¬Q ∨ ¬P)}
P →{(P →Q) ∧¬(¬Q ∨ ¬P)} ⇔ ¬P ∨ {(P →Q) ∧¬(¬Q ∨ ¬P)}
⇔ ¬P ∨ {(¬ P ∨ Q) ∧ (Q ∧P)} [P →Q ⇔(¬ P ∨ Q)]
⇔ ¬P ∨ {(¬ P ∨ Q) ∧ (Q ∧P)} [Distributive Law]
⇔ ¬P ∨ {(¬ P ∧ (Q ∧P)) ∨ (Q∧ (Q ∧P)}
⇔ ¬P ∨ {(¬ P ∧ P) ∧Q) ∨ ((Q∧ Q) ∧P)} [commutative law]
⇔ ¬P ∨ {F0 ∧Q) ∨ ((Q ∧P)} [Inverse law(¬ P ∧ P) ⇔ F0 ]
⇔ ¬P ∨ {F0 ∨ ((Q ∧P)} [Domination law( P ∧ F0) ⇔ F0 ]
⇔ ¬P ∨ (Q ∧P) [Identity law( P V F0) ⇔ P ]
⇔ (¬P ∧T0 )∨ (Q ∧P) [(¬P ∧T0 ) ⇔¬P identity Law]
Example - 5: Obtain disjunctive normal forms of ¬(P ∨ Q) ↔(P ∧ Q)
Solution: ¬(P ∨ Q) ↔(P ∧ Q)
R S
⇔ (¬(P ∨ Q) ∧ (P ∧ Q)) ∨ (¬(¬(P ∨ Q)) ∧ ¬(P ∧ Q)) [using R↔ S ⇔ (R ∧ S) ∨ (¬R ∧ ¬S)]
⇔ (¬(P ∨ Q) ∧ (P ∧ Q)) ∨ ((P ∨ Q) ∧ ¬(P ∧ Q))
⇔ ((¬P ∧ ¬Q) ∧ (P ∧ Q)) ∨ ((P ∨ Q) ∧ (¬P ∨ ¬Q))
⇔ (¬P ∧ ¬Q ∧ P ∧ Q) ∨ ((P ∨ Q) ∧ ¬P ) ∨ ((P ∨ Q) ∧ ¬Q)
⇔ (¬P ∧ ¬Q ∧ P ∧ Q) ∨ (P ∧ ¬P ) ∨ (Q ∧ ¬P ) ∨ (P ∧ ¬Q) ∨ (Q ∧ ¬Q)
⇔ (¬P ∧ P) ∧ (¬Q ∧ Q) V (P ∧ ¬P ) ∨ (Q ∧ ¬P ) ∨ (P ∧ ¬Q) ∨ (Q ∧ ¬Q)
⇔ F0 ∧ F0 ∨ F0 ∨ (Q ∧ ¬P ) ∨ (P ∧ ¬Q) V F0
⇔ F0 ∨ F0 ∨ (Q ∧ ¬P ) ∨ (P ∧ ¬Q)
⇔ (Q ∧ ¬P ) ∨ (P ∧ ¬Q)
31/16
Exercises:
Find the disjunctive normal forms of the following:
1. (p v q v ~q) ∧ (p v ~p)
2. ~{p->(q ∧ r )}
3. p v [ ~p -> {q v (q ->~r)}]
4. Using the truth table, obtain a disjunctive normal form of
{ p ∧ ¬(q v r)} v [ { (p ∧ q) v ¬r} ∧ p ]
5. Find the conjunctive normal forms of the following:
i) (q->p) ∧(~p ∧ q )
ii) q v (p ∧ ¬q) v (¬p ∧ ¬q)
Principal Normal Forms:
Two types
1. Principal Disjunctive Normal Form
2. Principal Conjunctive Normal Form
Minterm: For a given number of variables, the minterm consists of conjunctions
in which each statement variable or its negation, but not both, appears only
once.
Let P and Q be the two statement variables. Then there are 22 minterms given by
P ∧ Q, P ∧ ¬Q, ¬P ∧ Q, and ¬P ∧ ¬Q.
Minterms for three variables P , Q and R are P ∧ Q ∧ R, P ∧ Q ∧ ¬R, P ∧ ¬Q ∧ R,
P∧ ¬Q ∧ ¬R, ¬P ∧ Q ∧ R, ¬P ∧ Q ∧ ¬R, ¬P ∧ ¬Q ∧ R and ¬P ∧ ¬Q ∧ ¬R.
P Q P∧Q P ∧ ¬Q ¬P ∧ Q ¬P ∧ ¬Q
T T T F F F
T F F T F F
F T F F T F
F F F F F T
From the truth tables of these minterms of P and Q, it is clear that
i) no two minterms are equivalent
ii) Each minterm has the truth value T for exactly one combination of the truth
values of the variables P and Q.
Principal Disjunctive Normal Form
Definition: For a given formula, an equivalent formula consisting of disjunctions of
minterms only is called the Principal disjunctive normal form of the formula.
The principal disjunctive normal formula is also called the sum-of-products canonical form.
METHOD - I:
Rules:
• First replace →, by their equivalent formula containing only ∧, ∨ and ¬.
• Next, negations are applied to the variables by De Morgan‘s laws followed by the
application of distributive laws.
• Any elementarily product which is a contradiction is dropped. Minterms are obtained in
the disjunctions by introducing the missing factors. Identical minterms appearing in the
disjunctions are deleted.
Example: Obtain the principal disjunctive normal form of
(1) P ∨ (P ∧ Q) (2)(¬P)∨ Q
Solution:
(1) P ∨ (P ∧ Q) ⇔ (P ∧ T ) ∨ (P ∧ Q) [ P ∧ T ⇔ P Identity Law ]
⇔ (P ∧ (Q ∨ ¬Q)) ∨ (P ∧ Q) [ Inverse Law P ∨ ¬P ⇔ T ]
⇔ ((P ∧ Q) ∨ (P ∧ ¬Q)) ∨ (P ∧ Q) [distributive law]
⇔ (P ∧ Q) ∨ (P ∧ ¬Q) [Idempotent Law P ∨ P ⇔ P ]
(2) ¬P ∨ Q
Solution:
¬P ∨ Q ⇔ (¬P ∧ T ) ∨ (Q ∧ T ) [Identity Law P ∧ T ⇔ P]
⇔ (¬P ∧ (Q ∨ ¬Q)) ∨ (Q ∧ (P ∨ ¬P )) [Inverse P ∨¬P ⇔ T ]
⇔ (¬P ∧ Q) ∨ (¬P ∧ ¬Q) ∨ (Q ∧ P ) ∨ (Q ∧ ¬P)
[∵ P ∧ (Q ∨ R) ⇔ (P ∧ Q) ∨ (P ∧ R)
⇔ (¬P ∧ Q) ∨ (¬P ∧ ¬Q) ∨ (P ∧ Q) [Idempotent Law P ∨ P⇔ P ]
3) P ∨ (¬P ∧ Q)
P ∨ (¬P ∧ Q) ⇔ (P ∧ T ) ∨ (¬P ∧ Q)
⇔ (P ∧ (Q ∨ ¬Q)) ∨ (¬P ∧ Q)
⇔ (P ∧ Q) ∨ (P ∧ ¬Q) ∨ (¬P ∧ Q) which is the required PDNF.
4) P ∨ Q
P ∨ Q ⇔ (P ∧ T ) ∨ (Q ∧ T )
⇔ (P ∧ (Q ∨ ¬Q)) ∨ (Q ∧ (P ∨ ¬P ))
⇔ (P ∧ Q) ∨ (P ∧ ¬Q) ∨ (Q ∧ P ) ∨ (Q ∧ ¬P )
⇔ (P ∧ Q) ∨ (P ∧ ¬Q) ∨ (¬P ∧ Q) which is the required PDNF.
5) Example: Obtain the principal disjunctive normal form of
P → ((P → Q) ∧ ¬(¬Q ∨ ¬P )). (Nov. 2011)
Solution: Using P → Q ⇔ ¬P ∨ Q and De Morgan‘s law, we obtain
P →((P → Q) ∧ ¬(¬Q ∨ ¬P )) ⇔ ¬P ∨ ((¬P ∨ Q) ∧ (Q ∧ P ))
⇔ ¬P ∨ ((¬P ∧ Q ∧ P ) ∨ (Q ∧ Q ∧ P )) [Distributive Law]
⇔ ¬P ∨ ((¬P ∧ P ∧ Q ) ∨ (Q ∧ Q ∧ P ))
⇔¬P ∨ (F ∧ Q) ∨ (Q ∧ P) [(P ∧ ~ P )⇔ F0, P ∧ P ⇔ P ]
⇔ ¬P ∨ F v (P ∧ Q) [ (P ∧ F0)⇔ F ]
⇔ (¬P ∧ T ) ∨ (P ∧ Q) [ (P ∨ F0)⇔ P ]
⇔ (¬P ∧ (Q ∨ ¬Q)) ∨ (P ∧ Q)
⇔ (¬P ∧ Q) ∨ (¬P ∧ ¬Q) ∨ (P ∧ Q)
Hence (P ∧ Q) ∨ (¬P ∧ Q) ∨ (¬P ∧ ¬Q) is the required PDNF.
6) (P ∧ Q) ∨ (¬P ∧ R) ∨ (Q ∧ R)
⇔ (P ∧ Q ∧ T ) ∨ (¬P ∧ R ∧ T ) ∨ (Q ∧ R ∧ T )
⇔ (P ∧ Q ∧ (R ∨ ¬R)) ∨ (¬P ∧ R ∧ (Q ∨ ¬Q)) ∨ (Q ∧ R ∧ (P ∨ ¬P ))
⇔ (P ∧ Q ∧ R) ∨ (P ∧ Q ∧ ¬R) ∨ (¬P ∧ R ∧ Q) ∨ (¬P ∧ R ∧ ¬Q)
∨ (Q ∧ R ∧ P ) ∨ (Q ∧ R ∧ ¬P )
p ↔ q = (p q) (q p)
=( p q ) ( q p)
= (( p q ) q) ( p q ) p)
= (( p q) (q q)) ( ( p p ) (q p))
= (( p q) F) ( F (q p))
= (pq)(pq) in PDNF.
METHOD II
P Q P→Q Minterm
0 0 1 ¬P ∧¬Q
0 1 1 ¬P ∧Q
1 0 0 P ∧¬Q
1 1 1 P ∧Q
0 0 0 ¬P ∧¬Q ∧¬R 0 0 0 0
0 0 1 ¬P ∧¬Q ∧ R 0 1 0 1
0 1 0 ¬P ∧ Q ∧¬R 0 0 0 0
0 1 1 ¬P ∧ Q ∧ R 0 1 1 1
1 0 0 P ∧¬Q ∧¬R 0 0 0 0
1 0 1 P ∧ ¬Q ∧ R 0 0 0
0
1 1 0 P ∧ Q ∧¬R 1 0 0 1
1 1 1 P∧ Q∧ R 1 0 1 1
The dual of a minterm is called a Maxterm. For a given number of variables, the
maxterm consists of disjunctions in which each variable or its negation, but not
both, appears only once.
Each of the maxterm has the truth value F for exactly one combination of the
truth values of the variables.
Now we define the principal conjunctive normal form.
Let P and Q be the two statement variables. Then there are 22 maxterms given by
P ∨ Q, P ∨ ¬Q, ¬P ∨ Q, and ¬P ∨ ¬Q.
(P ∨ ¬P ), (Q ∨ ¬Q ), (P ∨ T), (P ∨ F )
Max-terms for three variables P , Q and R are (P ∨ Q ∨ R), (P ∨ Q ∨ ¬R), (P ∨ ¬Q ∨R),
(P ∨ ¬Q ∨ ¬R), (¬P ∨ Q ∨ R), (¬P ∨ Q ∨ ¬R), (¬P ∨ ¬Q ∨ R )and (¬P ∨ ¬Q ∨ ¬R).
P Q P∨Q P ∨ ¬Q ¬P ∨ Q ¬P ∨ ¬Q
T T T T T F
T F T T F T
F T T F T T
F F F T T T
From the truth tables of these max-terms of P and Q, it is clear that
i) no two max-terms are equivalent
ii) Each of the max-term has the truth value F for exactly one combination of the
truth values of the variables
Principal Conjunctive Normal Form
Definition: For a given formula, an equivalent formula consisting of
conjunctions of the max-terms only is known as its principle conjunctive
normal form. This normal form is also called the product-of-sums canonical
form. The method for obtaining the PCNF for a given formula is similar to the
one described previously for PDNF.
EX: IF P,Q are two propositions then PCNF have some or all of these Max-terms
(P ∨ Q) ∧ ( P ∨ ¬Q) ∧ ( ¬P ∨ Q) ∧ (¬P ∨ ¬Q).
Method –I Rules:
• First replace →, by their equivalent formula containing only ∧, ∨ and ¬.
• Next, negations are applied to the variables by De Morgan‘s laws followed by the
application of distributive laws.
• Any elementarily product which is a Tautology is dropped. Max-terms are obtained
in the conjunctions by introducing the missing factors. Identical max-terms
appearing in the conjunctions are deleted.
Find PCNF for the following
p ↔ q = (p q) (q p)
= (p q) (q p) in PCNF
=(p q) (p q)
Find PCNF of (pq) (qp)
= (p q) (q p)
= (p q) (q p) (p q= p q)
= (p q) (q p)
= (p (q p)) ( q (q p))
= (p q p) ( q q p) [P P ⇔ T ]
=(p p q) ( q p) [ P ∧ P ⇔ P, P v T ⇔ T ]
= (p q) (p q ) [ P∧T⇔P]
= (p q) in PCNF
Find PCNF of (p q) ( p q)
(p q) ( p q) ⇔ [(p q) p] [(p q) q]
⇔ [(p p) (q p)] [(p q) (q q)]
⇔ [T (q p)] [(p q) q] [P P ⇔ T, P v P ⇔ P ]
⇔ [ (q p)] [(p q) (q F)] [ P ∧ T ⇔ P, q F ⇔q ]
⇔ [ (q p)] [(p q) (q (p p)] [p p ⇔F]
⇔ [ (q p)] [(p q) (q p) (q p)] [ Distributive ]
⇔ ( p q) (p q) (p q) ( p q)
⇔ ( p q) (p q)
Exercises:
1. Obtain the Principal Disjunctive Normal Form of the following
i) p q ii) (p q)
2. By using PDNF, prove that {p ∨ (¬p∧ q)} ⇔ (p v q)
3. Obtain the Principal Conjunctive Normal Form of the following
i) ( p q) (q ↔ p) ii) (p) q iii) p (p v q)
Note: If the principal disjunctive (conjunctive) normal form of a given
formula A containing n variables is known, then the principal
disjunctive (conjunctive) normal form of ¬A will consist of the
disjunction (conjunction) of the remaining minterms (maxterms)
which do not appear in the
principal disjunctive (conjunctive) normal form of A. From A ⇔ ¬¬A
one can obtain the principal conjunctive (disjunctive) normal form of
A by repeated applications of De Morgan‘s laws to the principal
disjunctive (conjunctive) normal form of ¬A.
Example: Find the PDNF form PCNF of S : P ∨ (¬P → (Q ∨ (¬Q → R))).
Solution:
⇔ P ∨ (¬P → (Q ∨ (¬Q → R)))
⇔ P ∨ (¬(¬P ) ∨ (Q ∨ (¬(¬Q) ∨ R))
⇔ P ∨ (P ∨ Q ∨ (Q ∨ R)))
⇔ P ∨ (P ∨ Q ∨ R)
⇔P∨Q∨R which is the PCNF.
Now PCNF of ¬S is the conjunction of remaining maxterms, so
PCNF of ¬S : (P ∨ Q ∨ ¬R) ∧ (P ∨ ¬Q ∨ R) ∧ (P ∨ ¬Q ∨ ¬R) ∧ (¬P ∨ Q ∨ R)
∧ (¬P ∨ Q ∨ ¬R) ∧ (¬P ∨ ¬Q ∨ R) ∧ (¬P ∨ ¬Q ∨ ¬R) Hence the PDNF of S is
¬(PCNF of ¬S) : (¬P ∧ ¬Q ∧ R) ∨ (¬P ∧ Q ∧ ¬R) ∨ (¬P ∧ Q ∧ R) ∨ (P ∧ ¬Q ∧ ¬R)
∨ ( P ∧ ¬Q ∧ R) ∨ (P ∧ Q ∧ ¬R) ∨ (P ∧ Q ∧ R)
Rules of Inference
1
INFERENCE THEORY
In inference theory we check the validity of the arguments. There are two
branches in it.
1. Inference theory for propositional calculus and
2. Inference theory for predicate calculus.
In the inference theory for propositional calculus the arguments are in terms
of propositions (ordinary statements).
But in inference theory for predicate calculus the arguments are in terms of
predicates with quantifiers (which are defined later).
In this section we deal with the inference theory for propositional calculus.
Theory of Inference
Definition: The main aim of logic is to provide rules of inference to infer a conclusion from
certain premises. The theory associated with rules of inference is known as inference theory.
M. RAMA 3
We say that from a set of premises {H1, H2, · · · , Hn}, a conclusion C
follows logically iff
H1 ∧ H2 ∧ ... ∧ Hn ⇒ C
Here, H1, H2, …. Hn called the premises of the argument and C is called a
Conclusion of the argument.
The rules of inference are criteria for determining the validity of an argument.
Def: There exist rules of logic which can be employed for establishing the
validity of arguments. These rules are called the Rules of Inference.
M. RAMA 5
We write the above argument in the following tabular form
H1
H2,
.
.
Hn
C
Valid Argument:
An argument with premises P1, P2, P3 … Pn & conclusion Q is said to
valid if whenever each of premises is true, then the conclusion Q is
true. In other words
(P1 P2 P3….. Pn ) Q is called an argument.
When
(P1 P2 P3….. Pn ) Q
Note: the conclusion is true only in the case of valid argument.
RULES OF INFERENCES:
P ( p, q.....) Q ( p, ….)
I3 : P ⇒ P ∨ Q (addition)
I4 : Q ⇒ P ∨ Q
I5 : ¬P ⇒ P → Q
I6 : Q ⇒ P → Q
I7 : ¬(P → Q) ⇒ P
I8: ¬(P → Q) ⇒ ¬Q
Implication Rules
I9 : P, Q ⇒ P ∧ Q
I14 : P ∨ Q, P → R, Q → R ⇒ R (dilemma)
Rules of Inference (Logical Implications)
Simplification rules(Conjunctive Simplification):
I1 : (P Q) P
(P Q) P is a tautology.
P logically follows from (P Q)
I2 : (P Q) Q
(P Q) Q is a tautology.
Q logically follows from (P Q)
M. RAMA 15
Rules of Inference (contd.,)
Addition rules(Disjunctive Amplification):
I3 : P (P Q)
P (P Q) is a tautology
(P Q) logically follows from P
I4 : Q ( P Q )
Q (P Q) is a tautology
(P Q) logically follows from Q
M. RAMA 16
Rules of Inference (contd.,)
I5 : P (P Q)
P (P Q) is a tautology
(P Q) logically follows from P
I6 : Q (P Q)
Q (P Q) is a tautology
(P Q) logically follows from Q
M. RAMA 17
Rules of Inference (contd.,)
I7 : (P Q) P
(P Q) P is a tautology
P follows from (P Q)
I8 : (P Q ) (Q)
(P Q ) (Q) is a tautology
Q logically follows from (P Q)
M. RAMA 18
Rules of Inference (contd.,)
The inference
P Q
P
Q is valid
Modus ponens (Rule of detachment)
I11 : {P, PQ} Q
{ P (PQ) } Q is a Tautology
The argument
P
P Q
Q is valid
M. RAMA 20
Modus Tollens
I12 :{ PQ, Q } P
{ (PQ) Q} (P) is a Tautology
The argument
PQ
Q
P is valid
M. RAMA 21
Rule of Transitivity (Hypothetical Syllogism)
I13 :{ PQ, QR } (PR)
{ (PQ) (QR} (PR) is a Tautology
The argument
PQ
QR
PR is valid
M. RAMA 22
Dilemma
I14 :{ P Q, PR, QR } R is a logical implication.
The Inference
P Q
PR
QR
R is a valid Inference.
M. RAMA 23
Equivalence Rules
E1 : ¬(¬P) ⇔ P (Double negation)
E2 : P ∧ Q ⇔ Q ∧ P (Commutative Law)
E3 : P V Q ⇔ Q V P
E4 : (P ∧ Q) ∧ R⇔ P ∧ (Q ∧ R) (Associative Law)
E5 : (P V Q) V R⇔ P V (Q V R)
E6 : P ∧ (Q V R) ⇔ (P ∧ Q) V (P ∧ R) ( Distributive Law)
E7 : P V (Q ∧ R) ⇔ (P V Q) ∧ (P V R)
Equivalence Rules
E8 : ¬(P ∧ Q) ⇔ ¬ P V ¬ Q (Dmorgan’s Law)
E9 : ¬(P V Q) ⇔ ¬ P ∧ ¬ Q
E10 : P V P ⇔ P
E11: P ∧ P ⇔ P (Idempotent Law)
E12 : R V (P ∧ ¬P) ⇔ R
E13: R ∧ (P V ¬P) ⇔ R
E16 : P →Q ⇔ ¬P V Q
E17 : ¬(P →Q) ⇔ P ∧¬Q
E18 : P →Q ⇔ ¬Q → ¬P (Contra positive)
E19 : P →(Q → R)⇔ (P ∧ Q) →R
E20 : ¬(P ↔ Q) ⇔ P ↔ ¬Q
E21 : P ↔ Q ⇔ (P →Q) ∧(Q →P)
E22: (P ↔ Q) ⇔ (P ∧ Q) V(¬P ∧¬Q )
Test whether the following is a valid argument:
1. If Sachin hits a century, then he gets a free car.
Sachin hits a century
Sachin gets a free car
Let
p: Sachin hits a century
q: Sachin gets a free car
Then, the given argument reads
pq
p [(p q) ∧ p] q =T
q
In view of Modus Ponens Rule, this is a valid argument
Test whether the following is a valid argument:
2. If Sachin hits a century, then he gets a free car.
Sachin does not get a free car
Sachin has not hit a century
Let
p: Sachin hits a century
q: Sachin gets a free car
Then, the given argument reads
pq
¬q
¬p
In view of Modus Tollens Rule, this is a valid argument
3. If Sachin hits a century, then he gets a free car.
Sachin gets a free car
Sachin has hit a century
Let p: Sachin hits a century q: Sachin gets a free car
Then, the given argument reads
pq
q
[( p q ) q] p not valid
p [( p q ) q] p is not a tautology.
We note that if p q & q are true, there is no rule which asserts that p must be true. Indeed, p can
be false when p q and q are true.
p q pq (pq)q
0 1 1 1
5. If I have talent and work hard, then I will become successful in life.
If I become successful in life then I will be happy.
If I will be happy, then I did not work hard or I do not have talent.
1)Direct Proof
2)Indirect Proof
Example: Prove that ( p q) ( p q)
We have to prove that ( p q ) logically implies ( p q) .
Solution: Since p q is true, both p and q are true. Since p is true and p (q
r) is true, q r has to be true. Since q is true and q r is true, r has to be
true. Hence the given argument is valid.
p q r pq q r p (q r) (p q) (p (q r))
1 1 1 1 1 1 1
EX-2: Test the validity of the following arguments:
2. p r
qr
(p v q) r
Solution:
We note that
(p r) (q r) ⇔ (¬p v r) (¬ q v r)
⇔ (r v ¬p) (r v ¬q), by commutative law
⇔ r v (¬p ¬q), by distributive Law
⇔ ¬(p v q ) v r, by commutative and DeMorgan laws
⇔ (p v q ) r [p q ⇔ ¬p v q ]
Ex-3: Prove the validity of the following arguments:
(¬p v ¬q) (r s)
rt
¬t
p
Solution:
[(¬p v ¬q) (r s)] (r t) (¬t)
[(¬p v ¬q) (r s)] ¬r by Modus Tollens Rule [ ¬Q, P → Q ⇒ ¬P ]
[(¬p v ¬q) (r s)] (¬r v ¬s) by the rule of disjunctive amplification(p p v q)
[(¬p v ¬q) (r s)] [¬(r s)] by DeMorgan Law
⇔ ¬(¬p v ¬q) by the Modus Tollens Rule { [(P → Q) ¬Q ] ⇒ ¬P }
pq by DeMorgan Law
p [ P∧Q ⇒P (simplification) ]
The following are two important rules of inferences.
PQ -----(1)
QR -----(2)
P ------(3)
From (1) and (2), By the rule of transitivity,we have
PR --------(4)
From (3) and (4), By the rule of Modus ponens, R follows.
R logically follows from the given premises
M. RAMA 44
Example-2 : Show that R∨S follows logically from the premises
C ∨D, (C ∨D) → ¬H, ¬H → (A ∧ ¬B), and (A ∧ ¬B) → (R ∨ S).
Solution:
{1} (1) (C ∨ D) → ¬H Rule P
{2} (2) ¬H → (A ∧ ¬B) Rule P
{1, 2} (3) (C ∨ D) → (A ∧ ¬B) Rule T, (1), (2), and I13
{4} (4) (A ∧ ¬B) → (R ∨ S) Rule P
{1, 2, 4} (5) (C ∨ D) → (R ∨ S) Rule T, (3), (4), and I13
{6} (6) C ∨ D Rule P
{1, 2, 4, 6} (7) R ∨ S Rule T, (5), (6), and I11 [P, P → Q Q ]
Hence the result.
Example-3: Show that S ∨R is tautologically implied by (P ∨ Q) ∧ (P → R) ∧ (Q → S).
Solution:
{1} (1) P∨Q Rule P
{1} (2) ¬P → Q Rule T, (1) P → Q ⇔ ¬P ∨ Q
{3} (3) Q→S Rule P
{1, 3} (4) ¬P → S Rule T, (2), (3), and (I13 : Hypothetical Syllogism)
{1, 3} (5) ¬S → P Rule T, (4), P → Q ⇔ ¬Q → ¬P (contra positive)
{6} (6) P→R Rule P
{1, 3, 6} (7) ¬S → R Rule T, (5), (6), and I13
{1, 3, 6} (8) S∨R Rule T, (7) and P → Q ⇔ ¬P ∨ Q
Hence the result.
OR
Example: Show that S ∨R is tautologically implied by (P ∨ Q) ∧ (P → R) ∧ (Q → S).
Solution:
(P ∨ Q) ∧ (P → R) ∧ (Q → S)
⇔ (¬P → Q) ∧ (Q → S) ∧ (P → R)
(¬P → S) ∧ (P → R)
⇔ (¬R → ¬P) ∧ (¬P → S) (P → Q ⇔ ¬Q → ¬P)
¬R → S
⇔ ¬(¬R) ∨ S
⇔R∨S (P → Q ⇔ ¬P ∨ Q)
⇔S∨R
This proves the required result.
Exercises:
1. Prove that the following arguments are valid
i) p q
iii) (¬ p v q) → r
ii) p → (q → r)
r → (s v t)
¬p pvs
¬s ∧ ¬u
¬p t→q
¬u → ¬t
¬s
p
¬ r → ¬t
We shall now introduce a third inference rule, known as CP or rule of conditional proof.
Rule CP: If we can derive S from R and a set of premises, then we can derive R → S from
the set of premises alone.
Rule CP is not new for our purpose here because it follows from the equivalence
(P ∧ R) → S ⇔ P → (R → S)
Let P denote the conjunction of the set of premises and let R be any formula. The above
equivalence states that if R is included as an additional premise and S is derived from P ∧ R,
then R → S can be derived from the premises P alone.
Rule CP is also called the deduction theorem and is generally used if the conclusion of the
form R → S. In such cases, R is taken as an additional premise and S is derived from the
given premises and R.
Example: Show that R → S can be derived from the premises P → (Q → S), ¬R ∨ P , and
Q. (Nov. 2011)
Solution: Instead of deriving R → S, we shall include R as an additional premise and
show S
{1} (1) ¬R ∨ P Rule P
{2} (2) R Rule P (assumed premise)
{1, 2} (3) P Rule T, (1), (2), and I10 :¬P, P ∨ Q ⇒ Q
(disjunctive syllogism)
{4} (4) P → (Q → S) Rule P
{1, 2, 4} (5) Q→S Rule T, (3), (4), and I11 (Modus ponens)
{6} (6) Q Rule P
{1, 2, 4, 6} (7) S Rule T, (5), (6), and I11 (Modus ponens)
{1, 2, 4, 6} (8) R→S Rule CP
Example-2: Show that P → S can be derived from the premises ¬P ∨ Q, ¬Q ∨ R, and R → S.
Solution: We include P as an additional premise and derive S.
Inconsistency
If for every assignment of the truth values to the atomic variables, at least
one of the formulas H1, H2, … Hm is false, so that their conjunction is
identically false, then the formulas H1, H2, …, Hm are called inconsistent.
Thus, the given set of premises leads to a contradiction and hence it is inconsistent.
F ∧ T =F
Example: Show that the following set of premises is inconsistent:
If the contract is valid, then John is liable for penalty. If John is liable for penalty, he will
go bankrupt. If the bank will loan him money, he will not go bankrupt. As a matter of
fact, the contract is valid, and the bank will loan him money.
By assuming the negated conclusion we get a contradiction. Hence the given premises
imply the conclusion & the argument is valid.
Show that ¬ ¬(P ∧ Q) follows from ¬P ∧ ¬Q.
Solution.
We introduce (P∧ Q) as an additional premise and show that this additional premise
leads to a contradiction.
{1} (1) ¬ ¬ (P∧ Q) Rule P (assumed premise)
{1} (2) P∧ Q Rule T, (1) and E1
{1} (3) P Rule T, (2) and I1: (P∧ Q)=>P
Here (6) P∧¬P is a contradiction. Thus {1, 4} viz. ¬¬(P∧ Q) and ¬P∧¬Q leads to a
contradiction P ∧ ¬P.
•Prove by the method of indirect proof that p q, q r, r p .
Solution:
In each statement ’is a bachelor’ is a predicate. Both John and Smith have the same
property of being a bachelor.
In the statement logic, we require two different symbols to express them and these
symbols do not reveal the common property of these statements.
In predicate calculus these statements can be replaced by a single statement ‘x is a
bachelor’.
A predicate is symbolized by a capital letters which is followed by the list of variables.
The list of variables is enclosed in parenthesis.
If P stands for the predicate ‘is a bachelor’, then P (x) stands for ‘x is a bachelor’,
where x is a predicate variable.
`The domain for P (x) : x is a bachelor, can be taken as the set of all human names.
Once a value is assigned to x, P (x) becomes a statement and has the truth value.
All these sentences are about the students of II CSE and it is the predicate.
If P – denotes a student of II CSE
Since only one variable is required to use this predicate it is called as 1 – place predicate.
2 - PLACE PREDICATE:
In the above two sentences we require two variables (names) to define the predicates.
hence they are 2-place predicates.
If T denotes : is taller than (predicate)
x : Tina and y : Ramya (Variables)
The first sentence can be denoted as T(x,y).
n-PLACE PREDICATES:
Similarly it can be extended for n variables and in such a case it is called as
n-place predicates.
Quantifiers
Consider the following propositions:
1) All squares are rectangles
2) For every integer x, x2 is a non negative integer
3) Some determinants are equal to zero
4) There exists a real number whose square is equal to itself
In these propositions the words all, every, some, there exists are associated with the
idea of quantity. Such words are called quantifiers.
Quantifiers: Quantifiers are words that are refer to quantities such as ‘some‘ or ‘all‘.
"x A) p x ) means that the proposition is true for all x in the set A.
The set of values for which the statement is true is called truth set.
1) For example, consider the sentence “All human beings are mortal”.
Let P (x) denote ‘x is a mortal‘.
Then, the above sentence can be written as (∀x ∈ S) P(x) or ∀x P(x)
where S denote the set of all human beings.
∀x represents each of the following phrases, since they have essentially the same for all x.
For every x.
For each x.
For any x.
In the first case x is called bound variable and in the second case y is called as the
bound variable.
Consider (x) P(x, y). Here x is a bound variable and y is a free variable.
The scope of the formula is the formula immediately following the quantifier. If
the scope is an atomic formula no parenthesis are used to enclose the formula.
Example: (x)W(x)
If it is not an atomic formula then parenthesis are needed.
1. (x)P (x, y)
2. (x)(P (x) → Q(x))
3. (x)(P (x) → (∃y)R(x, y))
4. (x)(P (x) → R(x)) ∨ (x)(R(x) → Q(x))
5. (∃x)(P (x) ∧ Q(x))
In (1), P (x, y) is the scope of the quantifier, and occurrence of x is bound occurrence, while the
occurrence of y is free occurrence.
In (2), the scope of the universal quantifier is P (x) → Q(x), and all concrescences of x are bound.
In (3), the scope of (x) is P (x) → (∃y)R(x, y), while the scope of (∃y) is R(x, y). All occurrences of
both x and y are bound occurrences.
In (4), the scope of the first quantifier is P (x) → R(x) and the scope of the second is
R(x) → Q(x). All occurrences of x are bound occurrences.
In (5), the scope (∃x) is P (x) ∧ Q(x).
Truth value of a Quantified Statement
The following rules are employed for determining the truth value of a quantified
statement.
Rule -1: The statement “∀x ∈ S, P(x)” is true only when p(x) is true for each x ∈ S.
Rule -2: The statement “∃x ∈ S, P(x)” is false only when p(x) is false for every x ∈ S.
Accordingly, to infer that a proposition of the form “∀x ∈ S, P(x)” is false, it is
enough to exhibit one element a of S such that p(a) is false. This element a is called
counter example.
To infer that a proposition of the form “∃ x ∈ S, P(x)” is true, it is enough to exhibit
one element a of S such that p(a) is true.
Two Rules of Inference
Rule 3: If an open statement p(x) is known to be true for all in a universe S and if a∈S,
then p(a) is true.(This is known as the Rule of Universal Specification).
Rule 4:If an open statement p(a) is proved to be true for any x chosen from a set S,
then the quantified statement ∀x ∈ S, P(x)” is true.(This is known as the Rule of
Universal Generalization).
Logical Equivalence
Two quantified statements are used to be logically equivalent whenever they have the
same truth values in all possible situations
i) ∀x,[(P (x) ∧ Q(x)] ⇔(∀x,(P (x)) ∧ (∀x, Q(x))
ii) ∃x,[(P (x) V Q(x)] ⇔ (∃x,(P (x)) V (∃x, Q(x))
iii) ∃x, [(P (x) → Q(x)] ⇔ ∃x, [¬(P (x)) V Q(x)]
In some situations, there arise quantified statements of the form “∀x, ¬P (x)”. Such a
statement is taken to be logically equivalent to the statement “For no x, p(x)”.
Thus ∀x, ¬P (x) ⇔ For no x, p(x).
Ex: The stmt “for every integer x, x2 is non negative” is logically equivalent to the
statement “For no integer x, x2 is negative”.
Negations of Quantified Statements
Rule -5: To construct the negation of a quantified statement, change the quantifier from
universal to existential and vice versa, and also replace the open statement by its negation.
Example: Let P (x) denote the statement “x is a professional athlete” and let Q(x) denote the
statement “x plays soccer”. The domain is the set of all people.
(ii). There exists an x such that x is a professional athlete and x plays soccer.
“Some professional athletes plays soccer”.
Hence the negation is, “There exists an integer x such that x is odd and x2 -1 is not even (odd)”.
(The truth value of this statement is false).
Logical Implications involving Quantifiers
A quantified statement P is said to logically imply a quantified statement Q if Q is
true whenever P is true. Then we write P Q
Given a set of quantified statements P1,P2,P3…Pn and Q.
we say that Q is a valid conclusion from the premises P1,P2,P3…Pn or
(P1 ∧ P2 ∧P3… ∧ Pn) → Q is a valid argument if Q is true,
or equivalently if (P1 ∧ P2 ∧P3… ∧ Pn) Q.
The validity of an argument involving quantified statement is analyzed on the basis
of the Laws Of Logic & the Rules Of Inference.
Ex: Prove the following
i) ∀x, P(x) ∃x, P (x)
∀x, P(x) P (x) is true for every x ∈ S
P (x) is true for x = a∈ S
P (x) is true for some x ∈ S
∃x, P (x)
2. x) A x) B x)) x) A x) x) B x)
3. $x) A x) x) A x)
4. x) A x) $x)A x)
5. x) A x) x) B x) x) A x) B x))
4. If P(y) is true ∃x, P(x) is also true. This rule is called as Existential
Generalization(EG).
Py) for some element ‘y '
Rule EG: P(y) ⇒ (∃x)P(x) $xP x)
From P(y), one can conclude (∃x)P(x).
Example: Verify the validity of the following arguments:
“All men are mortal. Socrates is a man. Therefore, Socrates is mortal”.
or Show that (x)[H(x) → M(x)] ∧ H(s) ⇒ M(s).
Solution: Let us represent the statements as follows:
H(x) : x is a man M(x) : x is a mortal s : Socrates
2. py)qy) Rule ES
Hence the negation is, “There exists an integer x such that x is odd and x2 -1 is not even (odd)”.
(The truth value of this statement is false).
Automatic Theorem Proving
The shortcomings of procedures used in the process of derivation are :
•Rule P allows the introduction of a premise at any point in the derivation. But, it does
not suggest either the premise or the step at which it should be introduced.
•Rule T allows the introduction of any formula, obtained from the previous formulas.
But, there is neither definite choice of such formula nor any guidance for the use of any
particular implication and/or equivalence.
•Rule CP does not tell anything about the stages at which an antecedent has to be
introduced as an assumed premise. It does not indicate the stage, at which it is again
incorporated into the conditional.
Because of the above disadvantages, the process of derivation requires skill,
experience and intelligence to make the right decision at every step.
So, the process can not carried out mechanically.
Hence, a new set of rules and procedure is required to construct each
step of derivation in a specified manner and finally to show whether the
conclusion follows from the given premises.
The new formulation is based on the work of Hao Wang and consists of :
•10 rules,
•An axiom schema,
•Rules of well-formed sequents and formulas.
5. Axiom Schema: Let a and b are strings of formulas, each formula containing a
variable only, then the sequent a → b is an axiom iff a and b have at least one variable
in common. Ex : A, B, C → P, B, R, where A, B, C, P, and R are variables, is an axiom.
c
Note : If a → b is an axiom then a ⇒ b.
The new formulation is premise-free, so that in order to show that C follows from H1,
H2, …, Hm, we establish that
c
→ H1 (H2 (H3 … (Hm C) … )) (3) is a theorem.
We must show that
c
⇒ H1 (H2 (H3 … (Hm C) … )) (4)
New procedure involves showing (3) to be a theorem. For this, (4) is assumed as true
and then show that this assumption is or is not justified.
This can be accomplished by working backward from (4), using the rules and showing
that (4) holds if some simple sequent is a theorem.
Working backward continues till the simple possible sequents i.e., those
which do not have any connectives are obtained.
If these sequents are axioms then our assumption of (4) is justified.
If at least one of the simplest sequents is not an axiom, then the
assumption of (4) is not justified and C does not follow from H1, H2, …, Hm.
Ex 1: Show that P V Q follows from P.
Solution: We need to show that
C
(1) ⇒ P (P V Q)
C
(1) If (2) P ⇒ P V Q () [ X, a ⇒ Y, b, γ, then a ⇒ b, X Y, γ.]
c
(2) If (3) P ⇒ P, Q (V) [a ⇒ X, Y, b, γ, then a ⇒ b, X V Y, γ.]
The connective is eliminated in (1) by using the rule and the resulting P ⇒ P V Q is
named as (2).
Similarly (3) is obtained from (2) by using the rule V.
Finally (3) is a theorem, because it is an axiom.
Note: “(1) if (2)” means “if (2) then (1)” or “(1) holds if (2)”
The actual derivation is reversal of these steps in which (3) is an axiom that leads
to ⇒ P (P V Q) as shown
c
a) P ⇒ P, QAxiom
c
(1)⇒ (P V Q) P
(1)If (2) P V Q ⇒ P ()
Here, (3) is an axiom, but (4) is not. Hence P does not follow from P V Q.
c
Ex 2: Show that ⇒ (Q L (P Q)) P.
Solution:
c
(1) ⇒ (Q L (P Q)) P
Since (7) and (8) are axioms, the theorem (1) follows.
Ex 4: Show that S V R is tautologically implied by (P V Q) L (P R) L (Q S)
Solution :
c
(1). ⇒ ((P V Q) L (P R) L (Q S)) (S V R)
Now, (9) to (12) and (15) to (18) are all axioms; therefore the result follows.