0% found this document useful (0 votes)
12 views71 pages

RYS DSGT Lect2 Revised

The document provides an overview of logical connectives in discrete structures and graph theory, including negation, conjunction, disjunction, conditional, bi-conditional, and exclusive or. It explains how to form statements using these connectives and includes truth tables to illustrate their logical relationships. Additionally, it discusses well-formed formulas (WFF) and logical equivalence between statements.

Uploaded by

dhyeykhakhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views71 pages

RYS DSGT Lect2 Revised

The document provides an overview of logical connectives in discrete structures and graph theory, including negation, conjunction, disjunction, conditional, bi-conditional, and exclusive or. It explains how to form statements using these connectives and includes truth tables to illustrate their logical relationships. Additionally, it discusses well-formed formulas (WFF) and logical equivalence between statements.

Uploaded by

dhyeykhakhar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

Discrete Structures and Graph

Theory
Connectives
1. Negation (Not)
2. Conjunction (and)
3. Disjunction (or)
4. Conditional (if…then) /implication
5. Bi-conditional (if and only if)
Negation (NOT)
• Statements Formed by introducing “not” word
• “P” is Statement then negation of p is written as “not p“ or
It is not case that P.
• ┐p
• Unary Connective
• If P is true then ┐p is false and vice versa.

P ┐P
T F
F T
P:London is a city.
Then
┐p: London is not a city.
OR
┐p: It is not the case that London is a city.

Q: I went to my class yesterday


Then
┐Q:I did not go to my class yesterday
Conjunction (and)
• Statements Formed by introducing “and” word
• Binary Connective
• Used to combine two or more statements.
• Denote by ∧
• If both the statements are true then p ∧ Q is true otherwise
false.
P Q P∧Q
T T T
T F F
F T F
F F F
P:London is a capital of India.
Q: India is country.

London is a capital of India and India is country.

P ∧Q
Disjunction (OR)
• Statements Formed by introducing “OR” word
• Binary Connective
• Denote by ∨
• If one statement is true then p ∨ Q is true otherwise false.

P Q P∨Q
T T T
T F T
F T T
F F F
P:London is a capital of India.
Q: India is country.

London is a capital of India or India is country.

P∨Q
Conditional (if..then)
• Statements Formed by introducing “if…then ” word
• Binary Connective
• Denote by →
• If First statement is true and second statement is false then p
→ Q is false otherwise true.

P Q P→Q
T T T
T F F
F T T
F F T
“If elephants were red, then they could hide in
cherry trees.”.

P →Q
P is known as Antecedent
Q is known as consequent

For Q → P, vice versa


Implication
• If you study regularly you then you will get grade
‘A’
Case 1 : You did regular study , you got A grade.
(P → Q) : True
Case 2: You did regular study ,by chance you didn’t
get grade A. (P → Q) : False
Case 3: You didn’t study regularly, you may get grade
A. (P → Q) : True
Case 4: You didn’t study regularly, you didn’t get
grade A. (P → Q) : True
Some reading for P->Q
• “p implies q” • “p only if q”
• “if p, then q” • “p is sufficient for
• “if p, q” q”
• “when p, q” • “q is necessary for
p”
• “whenever p, q”
• “q follows from p”
• “q if p”
• “q is implied by p”
• “q when p”
We will see some equivalent
• “q whenever p” logic expressions later.
Bi-conditional (if and only if)
• Statements Formed by introducing “if and only if
” word
• Binary Connective
• Denote by ↔
• If both the statement has same truth value then
p ↔ Q is true otherwise false.

P Q P↔Q
T T T
T F F
F T F
F F T
“x < y if and only if y > x.”

P↔Q
EX-OR (Either-Or)
• Statement formed by “Either Or” word.
• Exclusive Or
• P x Q proposition will be true, if exactly one
of two propositions of both is true.
Otherwise false
P Q Pc Q
T T v F

T F T
F T T
F F F
Inclusive or OR Exclusive or
• In order to get a job in this multinational
company , experience with C++ or Java is
mandatory.
Inclusive or OR Exclusive or
• In order to get a job in this multinational
company , experience with C++ or Java is
mandatory.
Inclusive OR

Disjunction
Inclusive or OR Exclusive or
• “When you buy a mobile of xyz company,
you get Rs.500 cashback or a mobile cover
of worth Rs.500.”
Inclusive or OR Exclusive or
• “When you buy a mobile of xyz company,
you get Rs.500 cashback or a mobile cover
of worth Rs.500.”
Exclusive OR
Statement Formula and Truth Table
• Atomic statements/proposition
• Compound statements/proposition
¬(P∧Q)↔(¬P)∨(¬Q), ¬(P∧Q) , ¬(P∧Q)
• Statement formula
•Truth Table
n
•2 where n is number of distinct statement variable

•P∧ ┐P
1
2 rows, n=1, 2

•(P∧Q)
2
4 rows, n=2, 2
• Statements and operators (Connectives and parenthesis) can be
combined in any way to form new statements.
• (¬P)∨(¬Q)

P Q
T T
T F
F T
F F
• Statements and operators can be combined in any way to
form new statements.
• (¬P)∨(¬Q)

P Q ¬P
T T F
T F F
F T T
F F T
• Statements and operators can be combined in any way to
form new statements.
• (¬P)∨(¬Q)

P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
• Statements and operators can be combined in any way to
form new statements.
• (¬P)∨(¬Q)

P Q ¬P ¬Q (¬P)∨(¬Q)
T T F F
T F F T
F T T F
F F T T
• Statements and operators can be combined in any way to
form new statements.
• (¬P)∨(¬Q)

P Q ¬P ¬Q (¬P)∨(¬Q)
T T F F F
T F F T T
F T T F T
F F T T T
¬(P∧Q)↔(¬P)∨(¬Q)

P Q

T T
T F
F T
F F
¬(P∧Q)↔(¬P)∨(¬Q)

P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
¬(P∧Q)↔(¬P)∨(¬Q)
P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
(P∧Q)

T
T
T
F
¬(P∧Q)↔(¬P)∨(¬Q)
P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
(P∧Q) ¬(P∧Q)
T F
T F
T F
F T
¬(P∧Q)↔(¬P)∨(¬Q)
P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
(P∧Q) ¬(P∧Q) (¬P)∨(¬Q)
T F F
T F T
T F T
F T T
¬(P∧Q)↔(¬P)∨(¬Q)
P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
(P∧Q) ¬(P∧Q) (¬P)∨(¬Q) ¬(P∧Q)↔(¬P)∨(¬Q)
T F F T
F T T T
F T T T
F T T T
¬(P∧Q)↔(¬P)∨(¬Q)
P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
(P∧Q) ¬(P∧Q) (¬P)∨(¬Q) ¬(P∧Q)↔(¬P)∨(¬Q)
T F F T
F T T T
F T T T
F T T T
Example
• Using the statements:
R:Mark is Rich.
H:Mark is happy
• Write the following statements in symbolic form:
• (a) Mark is poor but happy.
¬R∧H
• (b) Mark is rich or unhappy;
R∨¬H
• (c) Mark is neither rich nor happy.
¬R∧¬H
• (d) Mark is poor or he is both rich and unhappy.
¬ R ∨ (R ∧ ¬ H )
Example
• Let p be “It is cold” and let q be “It is raining”. Give
a simple verbal sentence which describes each of
the following statements:
• (a) ¬p; (b) p ∧ q; (c) p ∨ q; (d) q ∨¬p.
• (a) ¬p;
It is not cold.
• (b) p ∧ q;
It is cold and raining.
• (c) p ∨ q;
It is cold or it is raining
• (d) q ∨¬p.
It is raining or it is not cold.
Using the statements:
P:Food is good.
H:Food is cheap.
Good food is not cheap.
P → ¬H

Cheap food is not good.


H → ¬P
H → ¬P
WFF (well formed formula)
• Now consider the proposition :
Trying to construct a truth table for this is
quite confusing. Which is to be assumed?

Which part is calculated first?


for such cases we have order of precendence
for these operators.
WFF (well formed formula)
• A statement formula is said to be WFF if it
has :
1. Every Atomic statement is wff
2. If P is wff then ~ p is also wff
3. If P and Q are wff then (P∧Q) , (P ∨ Q),
and (P → Q) are wff
4. Nothing else is wff
For example:
Precedence of the operators
•~
•^
• V,
•.

For example ,
Equivalent Statements
• If truth values of statement formula/proposition A is equal
to the truth values of statement formula/proposition B for
every possible truth values then A and B are logically
equivalent to each other.

P Q ¬P ¬Q ¬(P∧Q) (¬P)∨(¬Q)

T T F F F F
T F F T T T
F T T F T T
F F T T T T
Denoted by symbol ⇔
• Let P be “Roses are red” and Q be “Violets are
blue.” Let S be the statement:
“It is not true that roses are red and violets are
blue.”
• Then S can be written in the form ¬(p ∧ q).
• Accordingly, S has the same meaning as the
statement:
“Roses are not red, or violets are not blue.”
Then S can be written in the form ¬p ∨ ¬q.
However, as noted above, ¬(p ∧ q) ⇔ ¬p ∨ ¬q.
Equivalent Statements
• The statements ¬(P∧Q) and (¬P) ∨ (¬Q) are logically equivalent,
since ¬(P∧Q) ↔ (¬P) ∨ (¬Q) is always true.

P Q ¬P ¬Q ¬(P∧Q) (¬P)∨(¬Q) ¬(P∧Q)↔(¬P)∨(¬Q)

T T F F F F T

T F F T T T T

F T T F T T T

F F T T T T T
Convert the following English statements in
symbolic form.

• You can access the internet from campus if


you are computer science major or you are
not a freshman.
Solution: P: You can access the internet
from campus.
Q: you are computer major.
R: you are a freshman.
P → (QV ¬R)
• You can ride on roller coaster if you are
under 4 feet tall unless you are older than 16
years old.
Solution :
P: You can ride on roller coaster
Q: You are under 4 feet
R: You are older than 16 years old.
(QV ¬R) → P
Logical Equivalence
The easiest way to check for logical equivalence is to
see if the truth tables of both variants have
identical last columns:

p q p →q p q ¬q ¬p ¬q→¬p
Logical Equivalence
The easiest way to check for logical equivalence is to
see if the truth tables of both variants have
identical last columns:

p q p →q p q ¬q ¬p ¬q→¬p
T T T
T F F
F T T
F F T
Logical Equivalence
The easiest way to check for logical equivalence is to
see if the truth tables of both variants have
identical last columns:

p q p →q p q ¬q ¬p ¬q→¬p
T T T T T
T F F T F
F T T F T
F F T F F
Logical Equivalence
The easiest way to check for logical equivalence is to
see if the truth tables of both variants have
identical last columns:

p q p →q p q ¬q ¬p ¬q→¬p
T T T T T F
T F F T F T
F T T F T F
F F T F F T
Logical Equivalence
The easiest way to check for logical equivalence is to
see if the truth tables of both variants have
identical last columns:

p q p →q p q ¬q ¬p ¬q→¬p
T T T T T F F
T F F T F T F
F T T F T F T
F F T F F T T
Logical Equivalence
The easiest way to check for logical equivalence is to
see if the truth tables of both variants have
identical last columns:

p q p →q p q ¬q ¬p ¬q→¬p
T T T T T F F T
T F F T F T F F
F T T F T F T T
F F T F F T T T
Exercises
•Prove that:

1) (P → Q) ⇔ ¬P∨Q
2) P → (Q →R) ⇔ (P∧Q) →R.
Tautologies and Contradictions
• Some propositions P contain only T in the last
column of their truth tables or, in other words,
they are true for any truth values of their
variables. Such propositions are called tautologies.
A tautology is a statement that is always true.

Examples:
• R∨(¬R)
∀ ¬(P∧Q) ↔(¬P)∨(¬Q)

• If S→T is a tautology, we write S⇒T.


• If S↔T is a tautology, we write S⇔T.
¬(P∧Q) ↔(¬P)∨(¬Q)
P Q ¬P ¬Q
T T F F
T F F T
F T T F
F F T T
(P∧Q) ¬(P∧Q) (¬P)∨(¬Q) ¬(P∧Q)↔(¬P)∨(¬Q)
T F F T
F T T T
F T T T
F T T T
Tautology by truth table
[¬p ∧(p ∨q )]
p q ¬p p ∨q ¬p ∧(p ∨q )
→q
T T

T F

F T

F F
Tautology by truth table
[¬p ∧(p ∨q )]
p q ¬p p ∨q ¬p ∧(p ∨q )
→q
T T F

T F F

F T T

F F T
Tautology by truth table
[¬p ∧(p ∨q )]
p q ¬p p ∨q ¬p ∧(p ∨q )
→q
T T F T

T F F T

F T T T

F F T F
Tautology by truth table
[¬p ∧(p ∨q )]
p q ¬p p ∨q ¬p ∧(p ∨q )
→q
T T F T F

T F F T F

F T T T T

F F T F F
Tautology by truth table
[¬p ∧(p ∨q )]
p q ¬p p ∨q ¬p ∧(p ∨q )
→q
T T F T F T

T F F T F T

F T T T T T

F F T F F T
Tautologies and Contradictions
• a proposition P is called a contradiction if it
contains only F in the last column of its truth table
or, in other words, if it is false for any truth
values of its variables.
• A contradiction is a statement that is always false.
Examples:
• R∧(¬R)
∀ ¬(¬(P∧Q)↔(¬P)∨(¬Q))

• The negation of any tautology is a contradiction,


and the negation of any contradiction is a
tautology.
• Two way to finding the Equivalences,
Tautology and Contradiction
• Truth Table
• Without Truth Table Using Substitution ( by
formulas)
P Q ¬P ¬Q ¬P∨Q P🡪Q

T T F F T T
T F F T F F
F T T F T T
F F T T T T
Logical Equivalences
• Identity Laws: p ∧ T ⇔ p and p ∨ F ⇔ p.
• Domination Laws: p ∨ T ⇔ T and p ∧ F ⇔ F.
• Idempotent Laws: p ∧ p ⇔ p and p ∨ p ⇔ p.
• Double Negation Law: ¬(¬ p) ⇔ p.
• Commutative Laws:
• (p ∨ q) ⇔ (q ∨ p) and (p ∧ q) ⇔ (q ∧ p).
• Associative Laws: (p ∨ q) ∨ r ⇔ p ∨ (q ∨ r)
• and (p ∧ q) ∧ r ⇔ p ∧ (q ∧ r).
Logical Equivalences
• Distributive Laws:
• p ∨ (q ∧ r) ⇔ (p ∨ q) ∧ (p ∨ r) and
• p ∧ (q ∨ r) ⇔ (p ∧ q) ∨ (p ∧ r).
• DeMorgan’s Laws:
• ¬(p ∧ q) ⇔ (¬ p ∨ ¬ q) and
• ¬(p ∨ q) ⇔ (¬ p ∧ ¬ q).
• Absorption Laws:
• p ∨ (p ∧ q) ⇔ p and p ∧ (p ∨ q) ⇔ p.
• Negation Laws: p ∨ ¬ p ⇔ T and p ∧ ¬ p ⇔ F.
Logical Equivalences for
Implication
Logical Equivalences for Double
Implication
Substitution instance
• A formula A is called substitution instance of formula B if A
can be obtained from B by substituting formulas for some
variable of B.

Examples:
• B:P →(J ∧ P)
• If P be R ↔ S
• A:(R ↔ S) →(J ∧ (R ↔ S))
• As like we can substitute the formula with another
formula if both have same truth values
• (R → S) ∧ (R ↔ S)
• (¬ R ∨ S) ∧ (R ↔ S)
• Equivalent formula can be substitute for each other.
• Prove that P → (Q →R) ⇔ (P∧Q) →R.
• P → (Q →R) ⇔ P →(¬ Q ∨ R) …..implication law
⇔ ¬P ∨ (¬ Q ∨ R) ..implication law
⇔ (¬P ∨ ¬ Q) ∨ R …Associative law
⇔ ¬(P ∧ Q) ∨ R …Associative law
⇔ (P∧Q) →R.
Prove: (p∧¬q) ∨ q ⇔ p∨q
(p∧¬q) ∨ q Left-Hand Statement
⇔ q ∨ (p∧¬q) Commutative
⇔ (q∨p) ∧ (q ∨¬q) Distributive
⇔ (q∨p) ∧ T Or Tautology
⇔ q∨p Identity
⇔ p∨q Commutative
Begin with exactly the left-hand side statement
End with exactly what is on the right
Justify EVERY step with a logical equivalence
Prove: (p∧¬q) ∨ q ⇔ p∨q
(p∧¬q) ∨ q Left-Hand Statement
⇔ q ∨ (p∧¬q) Commutative
⇔ (q∨p) ∧ (q ∨¬q) Distributive
Why did we need this step?
Our logical equivalence specified that ∨ is distributive on the
right. This does not guarantee the equivalence works on the
left!
Ex.: Matrix multiplication is not always commutative
(Note that whether or not ∨ is distributive on the left is not
the point here.)
Prove: p → q ⇔ ¬q → ¬p
p→q Contrapositive
⇔ ¬p ∨ q Implication Equivalence
⇔ q ∨ ¬p Commutative
⇔ ¬(¬q) ∨ ¬p Double Negation
⇔ ¬q → ¬p Implication Equivalence

If p → q is a statement then q → p is called


converse.
¬p → ¬q is inverse and
¬q → ¬p is contrapositive.
Prove: p → p ∨ q is a tautology
Must show that the statement is true for any value of p,q.

p→p∨q
⇔ ¬p ∨ (p ∨ q) Implication Equivalence
⇔ (¬p ∨ p) ∨ q Associative
⇔ (p ∨ ¬p) ∨ q Commutative
⇔ T∨q Or Tautology
⇔ q∨T Commutative
⇔ T Domination
This tautology is called the addition rule of
inference.

You might also like