Sunteți pe pagina 1din 50

Unit- 1

Mathematical Logic
Topics to be covered

• Propositions, Negation, Disjunction and Conjunction


• Well-formed formulas
• Truth tables
• Tautology, Implication and Equivalence statements
• Normal forms – DNF, CNF, PDNF, PCNF

2
What is Discrete Mathematics?

Discrete mathematics is the part of mathematics devoted to


the study of discrete objects

Discrete mathematics is the study of mathematical structures


that are fundamentally discrete rather than continuous
(Wikipedia).
Examples of discrete Data Examples of continuous Data
– Number of boys in the class. –Height of a person.
– Number of candies in a –Time in a race.
packet. –Distance traveled by a car
– Number of suitcases lost by
an airline.
3
What is Proposition?

Proposition is a declarative sentence which is either true or


false but not both

Ex: All the following declarative sentences are propositions.


• Amaravathi is the capital of the A.P.
• Hyderabad is the capital of Telangana.
• 1 + 1 = 2.
• 2 + 2 = 3.

4
What is Proposition?

• The following are propositions


– Today is Monday
– The grass is wet
– It is raining
• The following are not propositions
– C++ is the best language Opinion
– When is the pretest? Interrogative
– Do your homework Imperative
– What time is it?
– Exterminate!
– x < 43
5
What is Proposition?
Is the following sentence a proposition? If it is a proposition,
determine whether it is true or false.

Are you the V.C. of VFSTR University?

This is a question not the declarative sentence and hence


not a proposition.

Is the following sentence a proposition? If it is a proposition,


determine whether it is true or false.

X asked Y to come up with two slips in weekly-test .

This is an imperative sentence not the declarative sentence


and therefore not a proposition.
6
What is Proposition?

Is the following sentence a proposition? If it is a proposition,


determine whether it is true or false.

x+ 4 > 9.

Because this is true for certain values of x (such as x = 6) and


false for other values of x (such as x = 5)

it is an open sentence not a proposition

7
Exercise Problems

1. Which of these sentences are propositions? What are the


truth values of those that are propositions?

a) Baahubali is the biggest grosser in Indian film history.


b) New Delhi is the capital of India.
c) 2 + 3 = 5.
d) 5 + 7 = 10.
e) x + 2 = 11.
f ) Answer this question.

8
Exercise Problem

Which of the following are the propositions? What are the


truth values of those that are propositions?

a)Do not pass go.


b) What time is it?
c) There are no black flies in Maine.
d) 4 + x = 5.
e) The moon is made of green cheese
f) 2n ≥ 100

9
Proposition Variables…

The small letters are commonly used to denote the


propositional variables, that is, variables that represent
propositions, such as, p, q, r, s, ….

The truth value of a proposition is true, denoted by T or 1, if it


is a true proposition and false, denoted by F or 0, if it is a false
proposition.

10
Logical Connectives

Connectives are used to create a compound proposition from


two or more propositions

– Negation ( or !)
– And or logical conjunction ()
– Or or logical disjunction ()
– XOR or exclusive or ()
– Implication ( or )
– Bi-conditional ( or )

– We define the meaning (semantics) of the logical


connectives using truth tables

11
Negation

Let p be a proposition. The negation of p,


denoted by ~p is the statement

“It is not the case that p”.

The proposition p is read as “not p”.

The truth values of the negation of p and


p is the opposite

12
Examples of Negation

Find the negation of the following proposition


p : Today is Friday.
The negation is
~ p : It is not the case that today is Friday.

This negation can be more simply expressed by


~ p : Today is not Friday.

Write the negation of “6 is negative”.


The negation is
“It is not the case that 6 is negative”.
or
“6 is nonnegative”.
13
Practice Problems
What is the negation of each of these propositions?
a) Mei has an MP3 player.
b) There is no pollution in New Jersey.
c) 2 + 1 = 3.
d) The summer in Maine is hot and sunny.
What is the negation of each of these propositions?
a) Jennifer and teja are friends. b) There are 13 items in a
baker’s dozen. c) Abby sent more than 100 text messages
every day. d) 121 is a perfect square.
What is the negation of each of these propositions?
a) Steve has more than 100 GB free disk space on his laptop.
b) Zach blocks e-mails and texts from Jennifer.
c) 7 · 11 · 13 = 999.
d) Diane rode her bicycle 100 miles on Sunday.
14
What is Conjunction?

The conjunction of p and q, denoted by p˄q, is the proposition “p


and q”.

The conjunction p˄q is true when p and q are both true and is
false otherwise

The logical connective And is true only


when both of the propositions are true.

Examples
It is raining and it is warm
(2+3=5) and (1<2)
15
Example of Conjunction?

Find the conjunction of the propositions p and q, where


p : Today is Friday.
q : It is raining today.

The conjunction is

p˄q : Today is Friday and it is raining today

16
What is Disjunction?

The disjunction of p and q, denoted by p˅q, is the proposition


“p or q”.

The disjunction p˅q is false when both p and q are false and is
true otherwise.

The logical disjunction, or logical Or, is true if one or both of


the propositions are true.

Examples
It is raining or it is the second lecture
(2+2=5) V (1<2)
You may like cake or ice cream
17
What is Disjunction?

Find the disjunction of the propositions p and q, where


p : Today is Friday.
q : It is raining today.

The disjunction is
p˅q : Today is Friday or it is raining today

18
What is Exclusive OR?

• The exclusive Or, or XOR, of two


propositions is true when exactly one of
the propositions is true and the other one
is false

• Example
 The circuit is either ON or OFF but not
both
 Let ab<0, then either a<0 or b<0 but not
both
 You may have cake or ice cream, but
not both
19
What is Implication?
p → q is the proposition that is false
when p is true and q is false and true
otherwise • If p then q
p is called the hypothesis, • p implies q
antecedent, premise • If p, q
• p only if q
q is called the conclusion,
• q if p
consequence • q when p
• q whenever p
• q follows from p
• p is a sufficient condition
for q (p is sufficient for q)
• q is a necessary condition
for p (q is necessary for p

20
What is Bi-Conditional?

The biconditional p ↔ q is the proposition that is true when p


and q have the same truth values. It is false otherwise.

Note: It is equivalent to (p → q)  (q → p)

• p if and only if q
• p is a necessary and sufficient
condition for q
• if p then q, and conversely
• p iff q

21
Bi-Conditional Examples..
Examples
x>0 if and only if x2 is positive
The alarm goes off iff a burglar breaks in
Which of the following bi conditionals are true?
 x2 + y2 = 0 if and only if x=0 and y=0
sol: True. Both implications hold
 2 + 2 = 4 if and only if 2<2
sol: True. Both implications hold
 x2  0 if and only if x  0
False. The implication “if x  0 then x2  0” holds.
However, the implication “if x2  0 then x  0” is false.
Consider x=-1.
The hypothesis (-1)2=1  0 but the conclusion fails.
22
Statement Formula

A Statement formula is an Expression which is a


string consisting of variables, parentheses, and
connective symbols.

 Every string of these symbols is a formula

23
Well formed Formula

A well formed formula can be generated by following


rules.
 A statement variable standing alone is a wff

 If A is a wff, then ¬A is also wff

If A and B are well formed formulas, then


(A^B),(AVB),(A->B), (A<->B) are well formed formulas

 A string of symbols containing statement variables,


connectives, and parentheses is a well formed formula
iff it can be obtained by finitely many applications of
rules

24
Well formed Formula Examples

¬(P ^ Q)
¬(P V Q)
(P->(P V Q))
(P->(Q->R))

¬P ^ Q is not a well formed formula . A wff would be either


¬(P ^ Q) or( ¬P ^ Q)

(P->Q)->(¬Q) is not a well formed formula because ¬Q is not


a wff

25
Converse, Inverse and Contra
Positive
Consider the proposition p q
Converse is q  p
Inverse is p  q
Contrapositive is q  p

Statement: If P, then q.
Converse: If q , then p .
Inverse: If not p , then not q .
Contrapositive: If not q , then not p .

26
Converse, Inverse and Contra
Positive

Conditional: If it is a Monday then you will have weekly test

Converse: If you have a weekly test then it is a Monday

Inverse: If it is not a Monday then you will not have a


weekly test

Contra-positive: If you will not have a weekly test then it is


not a Monday

27
Practice Exercise

Let p and q be the propositions


p : I bought a lottery ticket this week.
q : I won the million dollar jackpot.
Express each of these propositions as an English sentence.
a)¬p b) p ∨ q c) p → q d) p ∧ q e) p ↔ q
f ) ¬p →¬q g) ¬p ∧¬q h) ¬p ∨ (p ∧ q)

Let p and q be the propositions “Swimming at the New Jersey


shore is allowed” and “Sharks have been spotted near the
shore,” respectively. Express each of these compound
propositions as an English sentence.
a) ¬q b) p ∧ q c) ¬p ∨ q d) p →¬q e) ¬q → p
f ) ¬p →¬q g) p ↔¬q h) ¬p ∧ (p∨ ¬q)
28
Practice Exercise?
Let p and q be the propositions
p :You drive over 65 miles per hour.
q :You get a speeding ticket.
Write these propositions using p and q and logical connectives

a) You do not drive over 65 miles per hour.


b) You drive over 65 miles per hour, but you do not get a
speeding ticket.
c) You will get a speeding ticket if you drive over 65 miles
per hour.
d) If you do not drive over 65 miles per hour, then you will
not get a speeding ticket.
e) Driving over 65 miles per hour is sufficient for getting a
speeding ticket.
29
Practice Exercise?

Let p, q, and r be the propositions


p :You have the flu. q :You miss the final examination. r :You
pass the course.
Express each of these propositions as an English sentence.
a) p → q b) ¬q ↔ r c) q →¬r d) p ∨ q ∨ r
e) (p →¬r) ∨ (q →¬r) f ) (p ∧ q) ∨ (¬q ∧ r)

Determine whether these bi-conditional are true or false.


a) 2 + 2 = 4 if and only if 1 + 1 = 2.
b) 1 + 1 = 2 if and only if 2 + 3 = 4.
c) 1 + 1 = 3 if and only if monkeys can fly.
d) 0 > 1 if and only if 2 > 1.

30
Practice Exercise problems
Determine whether the following conditional statements are
true or false.
a) If 1 + 1 = 3, then unicorns exist.
b) b) If 1 + 1 = 3, then dogs can fly.
c) If 1 + 1 = 2, then dogs can fly.
d) If 2 + 2 = 4, then 1 + 2 = 3.

Write each of these propositions in the form “p if and only if


q”.
a) If it is hot outside you buy an ice cream cone, and if you buy an ice
cream cone it is hot outside.
b) For you to win the contest it is necessary and sufficient that you have
the only winning ticket.
c) You get promoted only if you have connections, and you have
connections only if you get promoted.
d) If you watch television your mind will decay, and conversely.
31
Truth tables

Truth tables are used to show/define the relationships


between the truth values of
• The individual propositions and
• The compound propositions based on them

32
Construction of Truth tables

Construct the truth table for the following compound


proposition
(( p  q ) q )

p q pq q (( p  q ) q )

0 0 0 1 1
0 1 0 0 0
1 0 0 1 1
1 1 1 0 1

33
Construction of truth tables-
Exercise problems
1. Construct a truth table for each of these compound
propositions.
a) (p ∨ q) ∨ r b) (p ∨ q) ∧ r c) (p ∧ q) ∨ r d) (p ∧ q) ∧ r
e) (p ∨ q)∧¬r f ) (p ∧ q)∨¬r
2. Construct a truth table for each of these compound
propositions.
a)p → (¬q ∨ r) b) ¬p → (q → r) c) (p → q) ∨ (¬p → r)
d) (p → q) ∧ (¬p → r) e) (p ↔ q) ∨ (¬q ↔ r)
f ) (¬p ↔¬q) ↔ (q ↔ r)
3. Construct a truth table for each of these compound
propositions.
a) p →¬p b) p ↔¬p c) p ⊕ (p ∨ q) d) (p ∧ q) → (p ∨ q)
e) (q →¬p) ↔ (p ↔ q) f ) (p ↔ q) ⊕ (p ↔¬q)
34
Construction of truth tables-
Exercise problems

4. Construct a truth table for ((p → q) → r) → s.

5. Construct a truth table for each of these compound


propositions.
a)p ⊕ p b) p ⊕¬p c) p ⊕¬q d) ¬p ⊕¬q
e) (p ⊕ q) ∨ (p ⊕¬q) f ) (p ⊕ q) ∧ (p ⊕¬q)

6. Construct a truth table for (p ↔ q) ↔ (r ↔ s).

7. Construct a truth table for each of these compound


propositions.
a)p →¬p b) p ↔¬p c) p ⊕ (p ∨ q) d) (p ∧ q) → (p ∨ q)
e) (q →¬p) ↔ (p ↔ q) f ) (p ↔ q) ⊕ (p ↔¬q)
35
Tautology, Contradiction,
Contingency statements
A compound proposition that is always true, no matter
what the truth values of the propositions that occur in it
is called a tautology
A compound proposition that is always false is called a
contradiction
A proposition that is neither a tautology nor a contradiction
is a contingency

Examples
A simple tautology is p  p
A simple contradiction is p  p

36
Problems

Show that each of these conditional statements is a tautology by


using truth tables.
a) (p ∧ q) → p b) p → (p ∨ q) c) ¬p → (p → q) d) (p ∧ q) → (p → q)
e) ¬(p → q) → p f ) ¬(p → q)→¬q
Show that each of these conditional statements is a tautology by
using truth tables.
a) [¬p ∧ (p ∨ q)] → q b) [(p → q) ∧ (q → r)] → (p → r)
c) [p ∧ (p → q)] → q d) [(p ∨ q) ∧ (p → r) ∧ (q → r)] → r

Determine whether (¬p ∧ (p → q))→¬q is a tautology.

Show that (p ∨ q) ∧ (¬p ∨ r) → (q ∨ r) is a tautology.

37
Logical Equivalence statements

Propositions p and q are logically equivalent


iff p  q is a tautology.
Informally, p and q are equivalent if whenever p is true, q is
true, and vice versa
Notation: p  q (p is equivalent to q), p  q and q  p

Propositions (p  q) and
(p  q) are logically
equivalent

38
Example on Logical Equivalence

Show that (p  q)  (p  q)


0. (p  q)
1.  (p  q)  (q  p) Equivalence Law on 0
2.  (p  q)  (q  p) Implication Law on 1
3.  (((p  q)  (q  p))) Double negation on 2
4.  ((p  q)  (q  p)) De Morgan’s Law…
5.  ((p  q)  (q  p)) De Morgan’s Law
6.  ((p  q)  (p  p)  (q  q)  (q  p))
Distribution Law
7.  ((p  q)  (q  p)) Identity Law
8.  ((q  p )  (p  q)) Implication Law
9.  (p  q) Equivalence Law

39
Practice Problem on tautology

Show that (p  q) q is a tautology


0. (p  q) q
1.  (p  q)  q Implication Law on 0
2.  (p  q)  q De Morgan’s Law (1st) on 1
3.  p  (q  q) Associative Law on 2
4.  p  1 Negation Law on 3
5.  1 Domination Law on 4

40
Practice Problem

Show that (q  p)  (p  q)  q


0. (q  p)  (p  q)
1.  (q  p)  (p  q) Implication Law
2.  (q  p)  (p  q) De Morgan’s
& Double negation
3.  (q  p)  (q  p) Commutative Law
4.  q  (p  p) Distributive Law
5.  q  1 Identity Law
q Identity Law

41
Exercise Problems

1. Show that p ↔ q and (p ∧ q) ∨ (¬p ∧¬q) are logically


equivalent.
2. Show that ¬(p ↔ q) and p ↔¬q are logically equivalent.
3. Show that p → q and →¬p are logically equivalent.
4. Show that ¬(p ⊕ q) and p ↔ q are logically equivalent.
5. Show that (p → q) → (r → s) and (p → r) → (q → s) are not
logically equivalent.
6. Show that (p → r) ∧ (q → r) and (p ∨ q) → r are logically
equivalent.
7. Show that (p → q) → (r → s) and (p → r) →(q → s) are not
logically equivalent.
8. Show that ¬(p ⊕ q) and p ↔ q are logically equivalent.
9. Show that ¬(p ⊕ q) and p ↔ q are logically equivalent.
42
Normal Forms
A product of the variables and their negations in a formula is
called an elementary product

If P and Q are atomic variables, then P, ¬P^Q, ¬Q^P^¬P, P^ ¬P


are some examples of Elementary products.
 A sum of variables and their negations is called an elementary
sum
 If P and Q are atomic variables then P, ¬PVQ, ¬QVPV¬P are
examples for elementary sums
 Any part of an elementary sum or product which it self is an
elementary sum or product is called a factor of original
elementary sum or product

43
Normal Forms
Necessary and sufficient condition for an elementary product to
be identically false is that it contain at least one pair of factors in
which one is the negation of the another

 Necessary and sufficient condition for an elementary sum to


be identically True is that it contain at least one pair of factors in
which one is the negation of the another

44
Disjunctive Normal Form
A formula which is equivalent to given formula and which consists
of a sum of elementary products is called a disjunctive normal
form of the given formula

Ex: The disjunctive normal form of

1.P (P Q)  P ( P Q)  (P  P) (P Q).


2.  (P  Q) (P Q)  ( (P Q) (P Q)) ((P Q)  (P Q))
 ( P   Q  P  Q)  (P   P)  (Q   P)  (P   Q)  (Q  
Q).

45
Conjunctive Normal Form
A formula which is equivalent to a given formula and which
consists of a product of elementary sums is called a conjunctive
normal form of a given formula

The conjunctive normal form of


P  (P Q)  P  ( P  Q).
(P  Q)  P Q.
 (P⇔Q)   ((P Q)  (Q P))
(( P  Q)  ( Q  P))
( P  Q)   ( Q  P)
(P   Q)  (Q   P)
(P  Q)  (Q   Q)  (P   P)  ( P   Q).

46
Principal Disjunctive Normal
Form

Let us assume A and B be two statement variables. All possible


formulas by using conjunction are given as follows. The total
number of formulas for two variables A and B are 22 formulas.

They are A  B, A B, A  B and  A  B.


These are called minterms or Boolean conjunctions of A and B.
The minterms (2n terms) are denoted by M0, M1, … ,M2n-1.
A formula equivalent to a given formula consisting of the
disjunction of minterms only is called PDNF of the given formula

47
Obtain the PDNF of ( P  Q)
(P⇔ Q)

P Q  P Q P ⇔Q ( P Q)  (P⇔ Q)

T T F F T

T F T T T

F T T T T

F F T F F

From the above table


( P Q) (P⇔ Q)  (P Q)  (P Q)  ( P Q)  ( P
Q)  (P Q)  (P Q)
48
Principal Conjunctive Normal
Form

The duals of minterms are called maxterms. For a given number of


variables the maxterm consists of disjunctions in which each
variable or its negation, but not both, appears only once.

For a given formula, an equivalent formula consisting of


conjunctions of maxterms only is known as its principal
conjunctive normal form. This is also called the product of sums
canonical form.

49
Principal Conjunctive Normal
Form

Example2:
Obtain PCNF for A : ( P R)  ((Q P)  (P Q)).
Solution:
A  (P R) (( Q P) ( P Q))
 (P R (Q  Q))  (P  Q (R  R))  ( P Q (R  R))
 (P Q R) (P  Q R) (P  Q R) (P  Q  R) ( P
Q R) ( P Q  R)
 (P Q R)  (P  Q R)  (P  Q  R)  ( P Q R)  (
P Q  R)
 p (0,2,3,4,5).

50

S-ar putea să vă placă și