Download as pdf or txt
Download as pdf or txt
You are on page 1of 54

BOOKS

• Discrete Mathematics and Its


Applications
By Kenneth H. Rosen
• Discrete Mathematics
By T.Veerarajan
• Discrete Mathematics
By P.Sivaramakrishna Das
& C.Vijayakumari
TOPICS

• LOGIC AND PROOFS

• COMBINATORICS

• GRAPHS

• ALGEBRAIC STRUCTURES

• LATTICES AND BOOLEAN ALGEBRA


OBJECTIVES
• To extend student‘s logical and mathematical maturity and
ability to deal with abstraction.

• To introduce most of the basic terminologies used in computer


science courses and application of ideas to solve practical
problems.

• To understand the basic concepts of combinatorics and graph


theory.

• To familiarize the applications of algebraic structures.

• To understand the concepts and significance of lattices and


boolean algebra which are widely used in computer science and
engineering.
UNIT-I LOGIC AND PROOFS
• Propositional logic
• Propositional equivalences
• Rules of inference
• Predicates and quantifiers
• Nested quantifiers
• Introduction to proofs
• Proof methods and strategy.
Introduction

• Logic is the discipline that deals with


the methods of reasoning.

• It provides rules and techniques for


determining whether a given
argument is valid or not.
• Logical reasoning is used
▪ In mathematics to prove theorems.

▪ In computer science to verify the


correctness of program.

▪ In physical sciences to prove theorems.

▪ To solve multitude problems in our every


day life.
• Logic is concerned with studying
arguments and conclusions.

• There are two main components of


logic
❖Propositional Logic.

❖Predicate Logic.
Propositional Logic
• The study of propositional logic consist
of syntax (grammar), sematics (meaning),
inference rules and derivation.
• Propositional logic can be considered as
a language of human reasoning.
• It consists of
▪ Propositional Variables denoted by
𝐩, 𝐪, 𝐫, 𝐬, … . (which are simple statements).
▪ Propositional constants denoted by T and
F (True or False)
▪ Connectives or basic logical operators
denoted by ∧, ∨, ∼, → , ↔ .
Propositions (Statements)
• A declarative sentence which is true
or false, but not both, is called a
proposition or statement.
• Sentences which are exclamatory,
interrogative or imperative in nature
are not propositions.
Examples:
1. New Delhi is the capital city of India.

2. How beautiful is rose?

3. 2 + 3 = 3.

4. What time is it?

5. 𝑥 + 𝑦 = 𝑧.

6. Take a cup of coffee.

In the given statements (2), (4) and (6) are not


propositions as they are not declarative in nature.

Statements (1) and (3) are propositions but (5) is not


since (1) is true, (3) is false and (5) is neither true nor false
as the values of 𝑥, 𝑦 𝑎𝑛𝑑 𝑧 are not assigned.
• If a proposition is true, we say that the truth
value of that proposition is true, denoted by T or
1.
• If a proposition is false, we say that the truth
value of that proposition is false, denoted by F or
0.
Primitive Proposition:
A proposition is primitive or primary or atomic, if
it cannot be broken into simpler propositions.

In otherwords, primitive propositions do not


contain logical connectives.
• Compound Proposition:
A proposition obtained by combining two
or more propositions by means of logical
connectives is called a compound proposition or
compound statement or molecular statement.
• Truth Table:
A table displaying the truth values of a
compound statement in terms of its component
parts is called the truth table.
Logical Connectives or Logical Operators:
• In logic, the letters 𝑝, 𝑞, 𝑟, 𝑠, … . denote
propositional variables.
• Variables can be replaced by propositions.
Example :
p : 2+3=5.
q : It is raining.
Negation(¬), Disjunction(∨), Conjunction(∨) are
called logical connectives or logical operators to
form a new propositions.
NEGATION (¬)[𝑵𝑶𝑻]
If p is a proposition , then the
negation of p is the proposition not p and
it is denoted by ¬𝐩 or ∼ 𝐩.

For example: let p: Today is Monday


¬p : Today is not Monday
The Truth table is given by

T F

F T
DISJUNCTION (∨)[OR]
If p and q are two propositions then
the disjunction of p and q is the compound
proposition p or q and is denoted by 𝒑 ∨ 𝒒.
➢ The compound statement 𝒑 ∨ 𝒒 is false if
both of p and q is false.
➢ 𝑝 ∨ 𝑞 is true if atleast one of p and q is true.
(i.e) Rule : F F implies F otherwise T.
TRUTH TABLE FOR DISJUNCTION
(∨) [OR]

T T T
T F T
F T T
F F F

(i.e) Rule : F F implies F otherwise T.


CONJUNCTION (∧)[AND]
If p and q are two propositions then
the conjunction of p and q is the compound
proposition p and q and is denoted by 𝒑 ∧
𝒒.
➢ The compound statement 𝒑 ∧ 𝒒 is true if
both of p and q is true.
➢ 𝑝 ∧ 𝑞 is false if atleast one of p and q is false
(i.e) Rule : T T implies T otherwise F.
TRUTH TABLE FOR CONJUNCTION
(∧) [AND]

T T T
T F F
F T F
F F F
(i.e) Rule : T T implies T otherwise F.
Conditional statement:(→)[If…then]
If p and q are propositions the compound
statement ‘if p, then q’ is called a conditional
statement or implication and is denoted by 𝒑 →
𝒒.
➢ In this implication p is called the Hypothesis
and q is called the conclusion.
➢ 𝒑 → 𝒒 is false if p is true and q is false.
➢ In other cases 𝒑 → 𝒒 is true.
(i.e) Rule : T F implies F otherwise T.
• NOTE:
➢The conditional statement 𝒑 → 𝒒
is read as
“ p implies q ” or
“ p only if q ” or
“ p is sufficient for q ” or
“ q if p ”
TRUTH TABLE FOR CONDITIONAL
STATEMENT (𝒑 → 𝒒) [𝑰𝒇 … 𝒕𝒉𝒆𝒏]

T T T

T F F

F T T

F F T

• (i.e) Rule : T F implies F otherwise T


VARIATIONS IN CONDITIONAL
STATEMENTS

If 𝒑 → 𝒒 is the conditional statement, then

(i) 𝐪 → 𝐩 is called the Converse of 𝒑 → 𝒒

(ii) ∼ 𝐩 →∼ 𝐪 is called the Inverse of 𝒑 → 𝒒

(iii) ∼ 𝐪 →∼ 𝒑 is called the Contrapositive


of 𝒑 → 𝒒.
❖ Example(2) Write down the contrapositive ,
converse and inverse of the implication

“ If it is raining then I get wet”.


Solution:
Let p : It is raining and q: I get wet
The given implication is p → q
Contrapositive : ¬q → ¬p
“If do not get wet then it is not raining”.
Converse : q → p is
“If I get wet then it is raining”.
Inverse : ¬p → ¬q is
“ If it is not raining then I do not get wet”.
Biconditional Statement (↔) [if and only if]

If p and q are propositions the compound


statement ‘ p if and only if q’ is called a
biconditional statement and is denoted by 𝒑 ↔
𝒒 .
➢ 𝒑 ↔ 𝒒 is true whenever p and q have the same
truth values and false otherwise.
(i.e) Rule: T T
T otherwise F
F F
Truth Table for Biconditional Statement (↔)

T T T

T F F

F T F

F F T

➢ p ↔ q can also be expressed as “ p iff q”

Or “ p is the necessary and sufficient condition for q”


Construct truth table for 𝑷 ∨ 𝑸 → 𝑷 ∧ 𝑸 .

Solution: Let 𝑆 = 𝑷 ∨ 𝑸 → 𝑷 ∧ 𝑸

T T T T T

T F T F F

F T T F F

F F F F T
Construct truth table for 𝒑 → 𝒒 → 𝒒 → 𝒑 .

Solution : Let 𝑆 = 𝒑 → 𝒒 → 𝒒 → 𝒑 .

T T T T T

T F F T T

F T T F F

F F T T T
Construct the truth table for ¬(𝑷 ∨ 𝑸) ∧ (𝑷 ∨ 𝑹)

Solution: Let S = ¬(𝑷 ∨ 𝑸) ∧ (𝑷 ∨ 𝑹)

T T T T F T F
T T F T F T F
T F T T F T F
T F F T F T F
F T T T F T F
F T F T F F F
F F T F T T T
F F F F T F F
WELL FORMED FORMULAS

The statement formula in which the order of


finding the truth values are indicated by using
parenthesis is called a well formed formulas.
For example:
(i) ¬ 𝑃 ∨ 𝑄 is a well formed formula (wff).
(ii) 𝑃 → 𝑄 ∧ 𝑅 is not a Wff,
but 𝑷 → (𝑸 ∧ 𝑹) is a Wff.
(Or) (𝑷 → 𝑸) ∧ 𝑹 is also a Wff.
Order of precedence of logical
connectives
▪ Negation ¬ precedes all other
operators.
▪ Conjunction ∧ precedes disjunction ∨
▪ The implications → and ↔ have lower
precedence. But among these two
→ precedes ↔ .
Tautology and Contradiction
➢ A statement formula which is always true
irrespective of the truth values of the individual
variables is called Tautology.

➢ A statement formula which is always false

is called a Contradiction.

➢ A statement which is neither a Tautology nor a


contradiction is called a contingency (or)
satisfiable.
Show that the statement given below is Tautology
𝑸 ∨ (𝑷 ∧ ¬𝑸) ∨ (¬𝑷 ∧ ¬𝑸)

Solution: Let 𝑺 = 𝑸 ∨ (𝑷 ∧ ¬𝑸) ∨ (¬𝑷 ∧ ¬𝑸)

T T F F F F T

T F F T T F T

F T T F F F T

F F T T F T T

This is a Tautology.
Verify whether the following statement are Tautology
or Contradiction or contingency ¬(𝒒 → 𝒓) ∧ 𝒓 ∧ (𝒑 → 𝒒).

:
Solution Let t = ¬ 𝒒 → 𝒓 ∧ 𝒓 , 𝑆 = ¬(𝒒 → 𝒓) ∧ 𝒓 ∧ (𝒑 → 𝒒)

T T T T T F F F
T T F T F T F F
T F T F T F F F
T F F F T F F F
F T T T T F F F
F T F T F T F F
F F T T T F F F
F F F T T F F F

This is a contradiction.
Verify whether the following statement are Tautology
or Contradiction or contingency (𝑷 ∨ 𝑸) → 𝑷.

Solution: Let S = (P ∨ Q) → P

T T T T

T F T T

F T T F

F F F T

This is a Contingency.
Logical Equivalence
▪ Two propositions P and Q are said to be

logically equivalent if P ↔ Q is a Tautology.

▪ We denoted this by 𝐏 ≡ 𝐐 (Or ) 𝑷 ⇔ 𝑸


❖ Note:
▪ The symbol ⇔ is sometimes used instead of ≡ to
denote logical equivalence.

▪ 𝑷 ≡ 𝑸 if and only if P and Q have the same truth

values.
Logical Implication
• let P and Q be two compound propositions,
if 𝑃 → 𝑄 is a Tautology, then “P is said to be logically
imply Q” and it is denoted by 𝑷 ⇒ 𝑸 .
• It is read as “ P implies Q”
• We also say that “Q logically follows from P”.
Note:
• The symbols → and ⟹ are different.
• → is logical connective (Or) logical operator.
• ⟹ is not a logical connective (Or) logical operator.
Show that 𝑷 → 𝑸 and ¬𝑷 ∨ 𝑸 are logically
equivalent.
Method : I
W.K.T, Two propositions P and Q are said to be
logically equivalent if 𝑷 ↔ 𝑸 is a Tautology.
To show : (𝑃 → 𝑄) ↔ (¬𝑃 ∨ 𝑄) ≡ 𝑇
Let 𝑺 = (𝑷 → 𝑸) ↔ (¬𝑷 ∨ 𝑸)

T T F T T T
T F F F F T
F T T T T T
F F T T T T

Hence the given statements are logically equivalent.


Method : II
W.K.T, 𝑃 ≡ 𝑄 if and only if P and Q have the same
truth values.

Given Statements are 𝑃 → 𝑄 and ¬𝑃 ∨ 𝑄

(1) (2) (3) (4) (5)


T T F T T

T F F F F

F T T T T

F F T T T

From column (4) and (5) they are logically equivalent.


Show that 𝒑 → (𝒒 → 𝒓) ⇒ (𝒑 ⟶ 𝒒) → (𝒑 → 𝒓)

Solution: Let s: p → (q → r) and t: (p →q) → (p → r)


To prove : s → t is a Tautology.

T T T T T T T T T
T T F T F F F F T
T F T F T T T T T
T F F F F T T T T
F T T T T T T T T
F T F T T F T T T
F F T T T T T T T
F F F T T T T T T
1.Write the following statement in symbolic form :

If Avinash is not in good mood or he is not

busy, then he will go to New Delhi.

Solution:

Let 𝒑: Avinash is not in good mood.

𝒒 ∶ He is not busy.

𝒓 ∶ He will go to New Delhi.

The symbolic form of the given statement is

(𝒑 ∨ 𝒒) → 𝒓.
2. Negate the statement: “ John is playing

football” in two different forms.

Solution :
Form 1 : John is not playing football.
Form 2 : It is not the case that John is
playing football.
3.State the truth value of “ If tigers have
wings then the earth travels round the
sun”

Solution:

Let 𝒑 ∶ Tigers have wings which is a false statement.

𝒒 ∶ Earth travels round the sun which is a true

statement.

• We have 𝒑 → 𝒒 So we have a combination of 𝑭→𝑻


which is True (T)

• So the truth value of the given statement is T.


Duality Law
• The dual of a compound proposition that
contains only the logical operators ∨, ∧
and ¬ is the proposition obtained by
replacing each ∨ by ∧, each ∧ by ∨, each 𝑻
by 𝑭 and each 𝑭 by 𝐓, where 𝑻 and 𝑭 are
special variables representing compound
propositions that are tautologies and
contradictions respectively.
Laws of Propositional Logic
Name of the
Primal Form Dual Form
Law
Idempotent
Law
Identity Law
Dominant
Law
Complement
F
Law
Associative
Law
Commutative
Law
Laws of Propositional Logic

Name of
Primal Form Dual Form
the Law

Distributive
Law

Absorption
Law

Demorgan’
s Law

Negation
Law
Equivalences Involving Conditionals

2 (Contrapositive)

6
Equivalences Involving Conditionals

4
1.Without using truth table , prove that
¬𝑷 ⟶ 𝑸 ⟶ 𝑹 ≡ 𝑸 ⟶ 𝑷 ∨ 𝑹

Solution:

¬𝑷 ⟶ 𝑸 ⟶ 𝑹 ≡ ¬𝑷 ⟶ ¬𝑸 ∨ 𝑹 (By 𝑷 → 𝑸 ≡ ¬𝑷 ∨ 𝑸)

≡ ¬(¬𝑷) ∨ (¬𝑸 ∨ 𝑹) (By 𝑷 → 𝑸 ≡ ¬𝑷 ∨ 𝑸)

≡ 𝑷 ∨ (¬𝑸 ∨ 𝑹) (By ¬(¬𝑷) ≡ 𝑷)

≡ (𝑷 ∨ ¬𝑸) ∨ 𝑹 (By Associative law)

≡ (¬𝑸 ∨ 𝑷) ∨ 𝑹 (By Commutative law)

≡ ¬𝑸 ∨ (𝑷 ∨ 𝑹) (By Associative law)

≡ 𝑸 ⟶ (𝑷 ∨ 𝑹) (By ¬𝑷 ∨ 𝑸 ≡ 𝑷 ⟶ 𝑸)
2. Without using truth table, show that
∼ 𝑷 ∧ ∼ 𝑸 ∧ 𝑹 ∨ 𝑸 ∧ 𝑹 ∨ 𝑷 ∧ 𝑹 ⇔ 𝑹.

Solution:
∼𝑷∧ ∼𝑸∧𝑹 ∨ 𝑸∧𝑹 ∨ 𝑷∧𝑹
⇔ (∼ 𝑷 ∧ ∼ 𝑸 ∧ 𝑹 ) ∨ ( 𝑸 ∧ 𝑹 ∨ 𝑷 ∧ 𝑹 ) (By Asso Law)
⇔ (∼ 𝑷 ∧ ∼ 𝑸 ∧ 𝑹 ) ∨ ((𝑸 ∨ 𝑷) ∧ 𝑹) (By Dis Law)
⇔ ∼ 𝑷 ∧∼ 𝑸 ∧ 𝑹 ∨ 𝑷∨𝑸 ∧𝑹
(By Asso & Comm Law)
⇔ (∼ (𝑷 ∨ 𝑸) ∧ 𝑹) ∨ ((𝑷 ∨ 𝑸) ∧ 𝑹) (By Demorgan’s Law)
⇔ (∼ 𝑷 ∨ 𝑸 ∨ 𝑷 ∨ 𝑸 ) ∧ 𝑹 (By Dis law)
⇔𝑻∧𝑹 (By Complement law, 𝒑 ∨∼ 𝒑 ≡T)
⇔𝑹 (By Identity law, 𝑷 ∧ 𝑻 ≡ 𝑷)
3. Show that
(𝑃 ∨ 𝑄) ∧ ¬(¬𝑃 ∧ ¬𝑄 ∨ ¬𝑅 ) ∨ (¬𝑃 ∧ ¬𝑄) ∨ (¬𝑃 ∧ ¬𝑅)
is a tautology by using equivalences.

Solution :
(𝑷 ∨ 𝑸) ∧ ¬(¬𝑷 ∧ ¬𝑸 ∨ ¬𝑹 ) ∨ (¬𝑷 ∧ ¬𝑸) ∨ (¬𝑷 ∧ ¬𝑹)

⇔ ( 𝑷 ∨ 𝑸 ∧ ¬ ¬𝑷 ∧ ¬𝑸 ∨ ¬𝑹 ) ∨ ( ¬𝑷 ∧ ¬𝑸 ∨ ¬𝑷 ∧ ¬𝑹 )
(By Associative law)

⇔ ( 𝑷 ∨ 𝑸 ∧ 𝑷 ∨ ¬ ¬𝑸 ∨ ¬𝑹 ) ∨ (¬𝑷 ∧ ¬𝑸 ∨ ¬𝑹 )
(By Demorgan’ s & Distributive law)

⇔ ( 𝑷 ∨ 𝑸 ∧ 𝑷 ∨ 𝑸 ∧ 𝑹 ) ∨ (¬𝑷 ∧ ¬ 𝑸 ∧ 𝑹 )
(By Demorgan’s law)
⇔ (𝑷 ∨ (𝑸 ∧ 𝑸 ∧ 𝑹 ) ∨ ¬(𝑷 ∨ 𝑸 ∧ 𝑹 )
(By Distributive law & Demorgan’ law)

⇔ (𝐏 ∨ 𝐐 ∧ 𝐐 ∧ 𝐑 ) ∨ ¬(𝐏 ∨ 𝐐 ∧ 𝐑 )
(By Associative law)
⇔ (𝑷 ∨ 𝑸 ∧ 𝑹 ) ∨ ¬(𝑷 ∨ 𝑸 ∧ 𝑹 )
(By Idempotent law, 𝑷 ∧ 𝑷 ≡ 𝑷)
⇔𝑻
(By Complement law, 𝑷 ∨ ¬𝑷 ≡ 𝑻)
Hence the given proposition is a tautology.
4. Prove that (𝑷 → 𝑸) ∧ (𝑸 → 𝑹) ⟹ (𝑷 → 𝑹).

Solution:

To prove (𝑷 → 𝑸) ∧ (𝑸 → 𝑹) ⟹ (𝑷 → 𝑹), we have to prove that

((𝑷 → 𝑸) ∧ (𝑸 → 𝑹)) → (𝑷 → 𝑹) is a tautology.

𝑷→𝑸 ∧ 𝑸→𝑹 → 𝑷→𝑹

≡ ( ¬𝑷 ∨ 𝑸 ∧ ¬𝑸 ∨ 𝑹 ) → (¬𝑷 ∨ 𝑹) (By 𝑷 → 𝑸 ≡ ¬𝑷 ∨ 𝑸)

≡ ¬( ¬𝑷 ∨ 𝑸 ∧ ¬𝑸 ∨ 𝑹 ) ∨ (¬𝑷 ∨ 𝑹) (By 𝑷 → 𝑸 ≡ ¬𝑷 ∨ 𝑸)

≡ (¬ ¬𝑷 ∨ 𝑸 ∨ ¬ ¬𝑸 ∨ 𝑹 ) ∨ (¬𝑷 ∨ 𝑹) (By Demorgan’s law)

≡ ( 𝑷 ∧ ¬𝑸 ∨ 𝑸 ∧ ¬𝑹 ) ∨ (¬𝑷 ∨ 𝑹) (By Demorgan’s law)


≡ 𝑷 ∧ ¬𝑸 ∨ ( 𝑸 ∧ ¬𝑹 ∨ (¬𝑷 ∨ 𝑹))

(By Associative law)

≡ 𝑷 ∧ ¬𝑸 ∨ ( 𝑸 ∨ ¬𝑷 ∨ 𝑹 ∧ (¬𝑹 ∨ ¬𝑷 ∨ 𝑹))

(By Distributive law)

≡ 𝑷 ∧ ¬𝑸 ∨ ( ¬𝑷 ∨ 𝑸 ∨ 𝑹 ∧ ((¬𝑹 ∨ 𝑹) ∨ ¬𝑷))

(By Associative law)

≡ 𝑷 ∧ ¬𝑸 ∨ ( ¬𝑷 ∨ 𝑸 ∨ 𝑹 ∧ (𝑻 ∨ ¬𝑷))

(By Complement law, 𝒑 ∨∼ 𝒑 ≡ 𝑻)

≡ 𝑷 ∧ ¬𝑸 ∨ ( ¬𝑷 ∨ 𝑸 ∨ 𝑹 ∧ 𝑻)

(By Dominant law, 𝒑 ∨ 𝑻 ≡ 𝑻)


≡ 𝑷 ∧ ¬𝑸 ∨ ¬𝑷 ∨ 𝑸 ∨ 𝑹

(By Identity law, 𝒑 ∧ 𝑻 ≡ 𝒑)

≡ 𝑷 ∨ ¬𝑷 ∨ 𝑸 ∨ 𝑹 ∧ ¬𝑸 ∨ ¬𝑷 ∨ 𝑸 ∨ 𝑹

(By Distributive law)

≡ ( 𝑷 ∨ ¬𝑷) ∨ (𝑸 ∨ 𝑹 ) ∧ ¬𝑷 ∨ (¬𝑸 ∨ 𝑸) ∨ 𝑹

(By Associative law)

≡ 𝑻 ∨ (𝑸 ∨ 𝑹 ) ∧ (¬𝑷 ∨ 𝑹) ∨ 𝑻

(By Complement law, 𝒑 ∨∼ 𝒑 ≡ 𝑻)

≡𝑻∧𝑻 (By Dominant law, 𝒑 ∨ 𝑻 ≡ 𝑻)

≡𝑻 (By Idempotent law, 𝒑 ∧ 𝒑 ≡ 𝒑)

Hence, (𝑷 → 𝑸) ∧ (𝑸 → 𝑹) ⟹ (𝑷 → 𝑹).

You might also like