You are on page 1of 27

DISCRETE

MATHEMATICS
Rajeev Kumar Singh
Goals of this course
This course should teach how to think
logically and mathematically

Five impor tant aspects would be covered

1: Mathematical reasoning

2: Combinatorial analysis

3: Discrete Structures

4: Algorithmic thinking

5: Applications and modelling


FOUNDATION:
LOGIC AND
PROOFS
1738-Anton
Wilhelm Amo This goat is yours

Treatise on the art This goat is a mother .

of accurately and Therefore this goat is your mother

soberly
philosophising
1921-Ludwig Wittgenstein-Tractatus
Logico philisophicus that logic cannot tell
us anything about the world but can only
clarify what we already know about the
world through non logical means
Propositional logic
A p r o p o s i t i o n i s a d e c l a ra t i ve s e n t e n c e t h a t i s e i t h e r t r u e o r f a l s e .

Examples of propositions:

a) The Moon is made of green cheese.

b) Wa s h i n g t o n i s t h e c a p i t a l o f U S A .

c) Delhi is the capital of India.

d) 2 + 0 = 1

e) 0 + 1 = 2

Examples that are not propositions.

f) Re a d t h i s c a r e f u l l y.

g) W h a t t i m e i s i t ?

h) x + 1 = 2

i) x + B = z
The area of logic that deals with proposition is called
propositional calculus /logic

Constructing Propositions:

P r o p o s i t i o n a l Va r i a b l e s : p , q , r , s , …

The proposition that is always true is denoted by T and the proposition that is always false is
denoted by F.

Compound Propositions; constructed from logical connectives and other propositions

–N e g a t i o n ¬

–C o n j u n c t i o n ∧

–D i s j u n c t i o n ∨

–I m p l i c a t i o n →

–B i c o n d i t i o n a l ↔
Negation

T h e n e g a ti o n of a p r o p o s i t i o n p is denoted
by ¬p and has the truth table as shown:

Example: If p denotes “The earth is


ova l .”, t h e n ¬ p denotes “It is not the
c a se t h a t t h e e a r t h i s o va l ,” o r m o r e
s i m p l y “ T h e e a r t h i s n o t o va l .”
Conjunction

The conjunction of propositions p and q is


d e n o te d b y p ∧ q an d h as t h i s t r u t h t ab l e a s
shown in right:

E x am p l e : If p d e n o t e s “ I a m a t o ffi c e .” a n d
q d e n o t e s “ I t i s ra i n i n g t o d ay.” t h e n p ∧ q
d e n o te s “ I a m a t o ffi c e a n d i t i s ra i n i n g
t o d a y.”
Disjunction

The disjunction of propositions p and q is


denoted by p ∨q and has this truth table:

E x a m p l e : I f p d e n o t e s “ I a m a t o ffi c e .” a n d
q d e n o t e s “ I t i s ra i n i n g t o d a y.” t h e n p ∨ q
d e n o t e s “ I a m a t o ffi c e o r i t i s r a i n i n g
t o d a y.”
In English “or” has
two distinct meanings.

“Inclusive Or” - In the sentence “Students who have


t a k e n C S 2 0 2 o r M a t h 1 2 0 m a y t a k e t h i s c l a s s ,” w e
assume that students need to have taken one of the
prerequisites,but may have taken both. This is the
m e a n i n g o f d i s j u n c t i o n . Fo r p ∨ q t o b e t r u e , e i t h e r o n e o r
both of p and q must be true.

“Exclusive Or” - When reading the sentence “Soup or


s a l a d c o m e s w i t h t h i s e n t r é e ,” w e d o n o t e x p e c t t o b e
able to get both soup and salad. This is the meaning of
E x c lu s i ve O r (Xor ). In p ⊕ q , o n e o f p a n d q m u s t b e
true, but not both. The truth table for ⊕ is:
Implication

If p and q are propositions, then p →q is a


conditional statement or implication which is
read as “if p, then q ” and has this truth table:

Example: If p d e n o t e s “ I a m a t h o m e .” a n d q
d e n o t e s “ I t i s r a i n i n g .” t h e n p →q denotes “If I
a m a t h o m e t h e n i t i s r a i n i n g .”

In p →q , p is the hypothesis (antecedent or


premise) and q is the conclusion (or
consequence).
Implication Cont..

In p → q there does not need to be any connection between the antecedent or the
consequent . The “meaning” of p → q depends only on the truth values of p and q .

These implications are perfectly fi ne,but would not be used in


ordinar y English.

“If the moon is made of green cheese, then I have more money than Bill Gates. ”

“If the moon is made of green cheese then I’m on welfare.”

“If 1 + 1 = 3, then your grandma wears combat boots.”


Implication Cont…

One way to view the logical conditional is to think of an obligation or


contract.
“If I am elected, then I will lower taxes.”

“If you get 100% on the fi nal, then you will get an A.”

If the politician is elected and does not lower taxes, then the voters
can say that he or she has broken the campaign pledge. Something
similar holds for the professor. This corresponds to the case where p
is true and q is false.
if p, q
if p, then q q unless ¬p
p only if q
p implies q q when p
Alternate
ways to
q whenever p q follows from p
q if p
p is q is necessary
express sufficient for q for p

conditional
a necessary a sufficient
statement condition for p is
q
condition for q is
p
q →p is the converse of p →q

From p →q we ¬q → ¬ p is the contrapositive of p →q

can form new ¬p→¬q is the inverse of p →q

Example: Find the


conditional converse, inverse,
and contrapositive
converse: If I do not go to town, then it is raining.
of “It raining is a
sufficient condition
inverse: If it is not raining, then I will go to town.
statements . for my not going to
town.”

contrapositive: If I go to town, then it is not raining.


Biconditional

If p and q are propositions, then we can


fo r m t h e b i c o n d i t i o n a l p r o p o s i t i o n p ↔ q , r e a d
as “p i f a n d o n l y i f q .” T h e biconditional
p ↔q denotes the proposition with this
truth table:

If p d e n o t e s “ I a m a t h o m e .” a n d q denotes
“ I t i s r a i n i n g .” t h e n p ↔q denotes “I am
a t h o m e i f a n d o n l y i f i t i s r a i n i n g .”
Cont…

“p if and only if q” is expressed in English:

p is necessar y and suffi cient for q

i f p then q , and conversel y

p iff q
Precedence

p q  r i s e q u i va l e n t to ( p  q )  r

If the intended meaning is p (q  r )

t h e n p a r e n t h e se s m u s t b e u s e d .
Equivalence

Two p r opo si t io ns a re
e q u i va l en t i f t hey a lway s
have the s a me t r uth va lue .

Exa mpl e : Show us ing a


tr ut h t a bl e t ha t the
co ndi ti ona l i s e qui va le nt t o
the cont ra p os it i ve.
Translating English sentences
Steps to convert an English sentence to a statement in
propositional logic

Identify atomic propositions and represent using propositional


variables.

Determine appropriate logical connectives

“ I f I g o t o H a r r y ’s o r t o t h e c o u n t r y, I w i l l n o t g o s h o p p i n g .”

p : I g o t o H a r r y ’s

q : I g o t o t h e c o u n t r y.

r: I will go shopping.
Pr ob l em : Trans l a te t he foll ow ing s e nte nc e in to
p r opo si t i ona l l og i c:

“You ca n a c ce s s t he In te r net f r om c a mp us o nly if


you a re a co mp ut er s c ie nc e ma j or or you a r e not a
f r es hm a n.”

Example One Sol ut io n: Le t a , c , a nd f r e pr e s ent


r e sp e ct i vel y “You ca n ac c es s t he i nte r net f r om
c a mp us ,” “ You a r e a c om pu te r s ci e nce m a jor,” a nd
“ You a r e a f r e shm a n.”

a→ ( c ∨ ¬ f )
Example: Express in propositional logic:

System and
Software engineers
“The automated reply cannot be sent when the
take requirements file system is full”
in English and
express them in a
precise specifi cation Solution: Let p denote “The automated reply can
be sent” and q denote “The file system is full.”
language based on
logic

q→ ¬ p
Are these specifications consistent? Solution: Let p denote “The
• “The diagnostic message is stored diagnostic message is stored in the
buffer.” Let q denote “The diagnostic
in the buffer or it is retransmitted.”
message is retransmitted” The
Defi nition: A list of
• “The diagnostic message is not
specification can be written as: p ∨
stored in the buffer.”
• “If the diagnostic message is
q, ¬p, p → q. When p is false and propositions is
q is true all three statements are
stored in the buffer, then it is
retransmitted.”
true. So the specification is consistent if it is
consistent.
• What if “The diagnostic message is possible to assign
not retransmitted is added.”
• Solution: Now we are adding ¬q
and there is no satisfying
truth values to the
assignment. So the specification is
not consistent. proposition variables
so that each
proposition is true
An island has two kinds of inhabitants, knights, who
always tell the truth, and knaves, who always lie.

Yo u g o t o t h e i s l a n d a n d m e e t A a n d B .

A s a y s “ B i s a k n i g h t .”

B s a y s “ T h e t w o o f u s a r e o f o p p o s i t e t y p e s .”

Example: What are the types of A and B?

Solution: Let p and q be the statements that A is a knight


a n d B i s a k n i g h t , r e s p e c t i v e l y. S o , t h e n  p r e p r e s e n t s t h e

Puzzles proposition that A is a knave and q that B is a knave.

If A is a knight, then p is true. Since knights tell the truth,


q must also be true. Then ( p ∧  q)∨ ( p ∧ q) would have to
be true, but it is not. So, A is not a knight and therefore p
must be true.

If A is a knave, then B must not be a knight since knaves


always lie. So, then both p and q hold since both are
knaves.
Solution: Let p and q be the statements that
A is a knight and B is a knight, respectively.
So, then  p represents the proposition that
A is a knave and  q that B is a knave.

If A is a knight, then p is true. Since knights


tell the truth, q must also be true. Then ( p ∧ 
q)∨ (  p ∧ q) would have to be true, but it is
not. So, A is not a knight and therefore  p
must be true.

If A is a knave, then B must not be a knight


since knaves always lie. So, then both  p and
 q hold since both are knaves .
Thanks

You might also like