0% found this document useful (0 votes)
17 views57 pages

DS Lecture 3 CST

The document covers various concepts in discrete structures, including logical propositions, truth tables, logical equivalence, De Morgan's laws, tautologies, contradictions, and conditional statements. It provides examples and exercises to illustrate these concepts, as well as definitions for necessary and sufficient conditions. The content is structured to facilitate understanding of logical reasoning and its applications in mathematics and computer science.

Uploaded by

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

DS Lecture 3 CST

The document covers various concepts in discrete structures, including logical propositions, truth tables, logical equivalence, De Morgan's laws, tautologies, contradictions, and conditional statements. It provides examples and exercises to illustrate these concepts, as well as definitions for necessary and sufficient conditions. The content is structured to facilitate understanding of logical reasoning and its applications in mathematics and computer science.

Uploaded by

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

Discrete Structures (CSC 102)

Aleena Rehman
ZUFESTM - Ziauddin University Faculty of
Engineering & Management
Examples
Q-1: Consider these statements,
P: It will rain today.
Q: I shall go to the party.
Solve these propositions with reference to the above statements:
(i) (~P V~Q)
(ii) (~P ^ Q)
(iii) (P V Q)
Q-2: Write the following in symbolic form
“If either Jennie eats pie or Minnie eats cake then Sherry will eat pudding”
Q-3: Construct a truth table for
(P ->Q) V (~Q ->P)

2
Q-4: Write the following statement for given values of p and q.
I.p: x3 = 8 , q: x = 2
II.p: She is a good student, q: She studies hard.
Q-5: Let, p, q, r are propositions :
p: Sia cooks well
q: Sia wins the cooking competition
r: Sia becomes a chef
Express the following propositions as English sentences:
i) (p -> q) ^ r
ii) (~p -> -r)
iii) (~p -> ~q) V (q -> r)

Discrete StructuresDiscrete 3
Structures
Solution:
1- (~P V~Q) : It will not rain today or I shall not go to the party.
(ii) (~P ^ Q) : It will not rain today and I shall go to the party.
(iii) (P V Q) : It will rain today or I shall go to the party.
2- The Logical form of the above compound statement is (p v q) -> r.
3-

4
4-

5-

5
Logical Equivalence

Two proposition form are called logically equivalent if


and only if they have identical truth values for each
possible substitution of propositions for their proposition
variable.

The logical equivalence of proposition forms P


and Q is written
P≡Q
Equivalence of Two Compound
Propositions P and Q

1. Construct the truth table for P.


2. Construct the truth table for Q using the
same proposition variables for identical
component propositions.
3. Check each combination of truth values of
the proposition variables to see whether the
truth value of P is the same as the truth
value of Q.
Equivalence Check

a. If in each row the truth value of P is the


same as the truth value of Q, then P and Q
are logically equivalent.

b. If in some row P has a different truth value


from Q, then P and Q are not logically
equivalent.
Example

• Prove that ¬ (¬p)≡ p

Solution

p ¬p ¬ (¬p)
T F T
F T F

As you can see the corresponding truth values of p


and ¬ (¬p) are same, hence equivalence is justified.
Example
Show that the proposition forms ¬(pq) and ¬p  ¬q are
NOT logically equivalent.

p q ¬p ¬q (pq) ¬(pq) ¬p¬q


T T F F T F F
T F F T F T F
F T T F F T F
F F T T F T T
Here the corresponding truth values
differ and hence equivalence does
not hold
Examples:
Show that statements P <-> Q and (P^Q)V(~P^~Q) are
equivalent

11
Examples:
Show that:
i. P -> Q ≣ ~P V Q
ii. P <-> Q ≣ (P -> Q) ∧ (Q -> P)
iii. P ⊕ Q ≣ (P ∧ ~Q) V (~P ∧ Q)

12
13
14
De Morgan’s laws
De Morgan’s laws state that:
The negation of an and proposition is
logically equivalent to the or proposition in
which each component is negated.

The negation of an or proposition is logically


equivalent to the and proposition in which
each component is negated.
Symbolically (De Morgan’s Laws)

1. ¬(pq) ≡ ¬p¬q

2. ¬(pq) ≡ ¬p¬q
Applying De-Morgan’s Law
Question: Negate the following compound Propositions

1. John is six feet tall and he weights at least 200


pounds.

2. The bus was late or Tom’s watch was slow.


18
19
Solution

a) John is not six feet tall or he weighs less


than 200 pounds.

b) The bus was not late and Tom’s watch


was not slow.
Inequalities and De Morgan’s Laws

Question Use De Morgan’s laws to write the negation of


-1< x 4
Solution: The given proposition is equivalent to

-1 < x and x 4,
By De Morgan’s laws, the negation is

-1 ≥ x or x > 4.
Given Statement:
x is greater than -1 AND x is less than or equal to 4
Mathematically:
(-1 < x) AND (x ≤ 4)
Negation:
To negate the statement, we first write it in its logical form: (-1 < x) AND (x ≤ 4)
Apply De Morgan's laws, which state:
Negation of (A AND B) = (NOT A) OR (NOT B)
Negate each part:
NOT (-1 < x) becomes x ≤ -1.
NOT (x ≤ 4) becomes x > 4.
Combine these with OR:
x ≤ -1 OR x > 4

22
23
Tautology and Contradiction

A tautology is a proposition form that is always true


regardless of the truth values of the individual
propositions substituted for its proposition variables. A
proposition whose form is a tautology is called a
tautological proposition.

A contradiction is a proposition form that is always false


regardless of the truth values of the individual
propositions substituted for its proposition variables. A
proposition whose form is a contradiction is called a
contradictory proposition.
Example
Show that the proposition form p¬p is a
tautology and the proposition form p¬p is a
contradiction.

p ¬p p ¬p p ¬p
T F T F
F T T F

Exercise: If t is a tautology and c is


contradiction, show that pt≡t and pc≡c?
27
Laws of Logic

1. Commutative laws
pq ≡ qp ; pq ≡ qp

2. Associative laws
p  (q  r) ≡ (p q)  r ; p(q r) ≡ (pq)r

3. Distributive laws
p  (q r ) ≡ (p  q)  (p  r)
p  (q  r) ≡ (p  q)  (p  r)
Laws of Logic

4. Identity laws
p  t ≡ p ; pc ≡ p

5. Negation laws
p¬p ≡ t ; p  ¬p ≡ c

6. Double negation law


¬(¬p) ≡ p

7. Idempotent laws
p  p ≡ p ; pp ≡ p
Laws of Logic

8. Universal bound laws


pt≡t ;pc≡ c

9. Absorption laws
p (pq) ≡ p ; p (p  q) ≡ p

10. Negation of t and c


¬t ≡ c ; ¬c ≡ t
Discrete StructuresDiscrete 31
Structures
Discrete StructuresDiscrete 32
Structures
Discrete StructuresDiscrete 33
Structures
34
Interpreting Conditional Statements
Examples
“The online user is sent a notification of a link error if
the network link is down”.
The statement is equivalent to
“If the network link is down, then the online user is sent a
notification of a link error.”
Using
p : The network link is down,
q : the online user is sent a notification of a link error.

The statement becomes (q if p)


p → q.
Examples
“When you study the theory, you understand the
material”.
The statement is equivalent to (using if for when)
“If you study the theory, then you understand the material.”
Using
p : you study the theory,
q : you understand the material.

The statement becomes (when p, q)


p → q.
Examples

“Studying the theory is sufficient for solving the


exercise”.

The statement is equivalent to


“If you study the theory, then you can solve the exercise.”
Using
p : you study the theory,
q : you can solve the exercise.

The statement becomes (p is sufficient for q)


p → q.
Activity
• Show that
p→q ≡ ¬p  q
This shows that a conditional proposition is simple a
proposition form that uses a not and an or.

• Show that
¬(p→q) ≡ p  ¬q
This means that negation of ‘if p then q’ is logically
equivalent to ‘p and not q’.
Solution
40
Negations of some Conditionals
• Original Proposition:
"If my car is in the repair shop, then I cannot get to class."
Negation:
"My car is in the repair shop, and I can get to class.“

(This is the negation of the conditional, where both parts of the condition are true but
the conclusion is false.)
• Original Proposition:
"If Sara lives in Athens, then she lives in Greece."
Negation:
"Sara lives in Athens, and she does not live in Greece."
(This is the negation of the conditional, where the premise is true, but the conclusion
is false.)
The basic formula for negating a conditional statement "If P, then Q" is:
To explain in simple terms:
•Original Statement: "If P, then Q"
This means if P happens, then Q will definitely happen.
•Negation:
The negation of this is:
"P is true, and Q is false."
This means that P is happening, but Q is not happening.

42
Examples

43
Contrapositiven
Definition
The contrapositive of a conditional proposition of the form ‘if p
then q’ is ‘if ¬q then ¬p’. Symbolically, the contrapositive of
p→q is ¬q→¬p.

A conditional proposition is logically equivalent to its contra-


positive.

Example
If today is Sunday, then tomorrow is Monday.
Contrapositive:
If tomorrow is not Monday, then today is not Sunday.
Converse and inverse of the Conditional

Suppose a conditional proposition of the form ‘If p then


q’ is given.
1.The converse is ‘if q then p’.
2.The inverse is ‘if ⌐p then ⌐q’.
Symbolically,
The converse of p→q is q→p,
And
The inverse of p→q is ⌐p→⌐q.
46
Discrete StructuresDiscrete 47
Structures
Interpreting Necessary and sufficient conditions

“If a number is divisible by 10, then it is divisible by 2”.


The clause introduced by If A number is divisible by 10” is called
the hypothesis. It is what we are given, or what we may assume.
The clause introduced by then It is divisible by 2 is called
the conclusion. It is the statement that "follows" from the
hypothesis.
When the If-then sentence is true, we say that the hypothesis is a
sufficient condition for the conclusion. Thus it is sufficient to know
that a number is divisible by 10, in order to conclude that it is
divisible by 2.
The conclusion is then called a necessary condition of that
hypothesis. For, if a number is divisible by 10,
it necessarily follows that it will be divisible by 2.
Necessary and Sufficient Conditions are important concepts in logic and
reasoning. These terms help explain the relationship between two statements,
typically in the context of conditional statements (like "If P, then Q").

1. Sufficient Condition:
A condition P is sufficient for another condition Q if, whenever P is true, Q must
also be true. In other words, P guarantees the truth of Q.
In simpler terms: If P happens, then Q will definitely happen.
Notation:
•Sufficient condition: If P, then Q (P ⇒ Q).
•Interpretation: P is sufficient to make Q true.

2. Necessary Condition:
A condition P is necessary for another condition Q if Q cannot be true without P
being true. In other words, Q can only occur if P also occurs. P is required for Q to
be true, but it does not guarantee Q.
•In simpler terms: For Q to happen, P must happen, but P alone does not
guarantee that Q will happen.
Notation:
•Necessary condition: If Q, then P (Q ⇒ P).
•Interpretation: Q cannot be true without P being true.
49
Discrete StructuresDiscrete 50
Structures
Interpreting Necessary and sufficient conditions

Example: Consider the proposition

‘if John is eligible to vote then he is at least 18 year


old’.
The truth of the condition ‘John is eligible to vote’ is
sufficient to ensure the truth of the condition ‘John is
at least 18 year old’.
Necessary and Sufficient Conditions
Let r and s are two propositions

r is a sufficient condition for s means ‘if r then s’.

r is a necessary condition for s means ‘if not r then not s’

r is necessary and sufficient condition for s means ‘r if


and only if s’
53
Discrete StructuresDiscrete 54
Structures
Questions: Write what is sufficient or necessary statement:

Statement 1: "If a student has a valid ID, then they can access the library."

Statement 2: "If you are a human, then you are a living being."

Statement 3: "If a person is a registered voter, then they are eligible to vote in elections."

Statement 4: "If a plant receives sunlight, then it will photosynthesize."

Statement 5: "If an athlete wins the race, then they receive a gold medal."

Statement 6: "If a number is divisible by 2, then it is an even number."

Statement 7: "If you have a degree, then you are educated."

Statement 8: "If it is a weekend, then I do not have work."

Discrete StructuresDiscrete 55
Structures
Solutions:
Statement 1:
1. Sufficient: Having a valid ID is sufficient for accessing the library (if you have a valid ID,
you can access the library).
2. Necessary: Having a valid ID is necessary to access the library (without it, you cannot
access).
Statement 2:
1. Being a human is a sufficient condition for being a living being (if you are human, you are
automatically a living being).
2. Being a living being is a necessary condition for being a human (you cannot be a human
without being a living being).
Statement 3:
1. Being a registered voter is a sufficient condition for being eligible to vote (if you are
registered, you can vote).
2. Being eligible to vote is a necessary condition for being a registered voter (you need to be
eligible to vote before registering).
Statement 4:
1. Receiving sunlight is a sufficient condition for photosynthesis (if a plant receives sunlight, it
will photosynthesize).
2. Photosynthesis is a necessary condition for a plant to receive sunlight (it doesn't make
sense for a plant to receive sunlight but not photosynthesize).

56
Statement 5:
1. Winning the race is the sufficient condition for receiving a gold
medal (if you win, you will get the medal).
2. Winning the race is also the necessary condition for receiving
the gold medal (you cannot get the gold medal without
winning).
Statement 6:
1. Being divisible by 2 is a sufficient condition for being an even
number.
2. Being an even number is a necessary condition for being
divisible by 2 (every even number must be divisible by 2).
Statement 7:
1. Having a degree is a sufficient condition for being educated (if
you have a degree, you are educated).
2. Being educated is a necessary condition for having a degree
(you need to be educated to earn a degree).
Statement 8:
1. Being a weekend is a sufficient condition for not having work
(if it is a weekend, you do not have work).
2. Not having work is a necessary condition for it being a
weekend (you cannot have work on a weekend for this
context).
57

You might also like