Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas
Department of Computer Science, CUI Lahore Campus: CSC102 - Discrete Structures by Mahwish Waqas
Lahore Campus
CSC102 - Discrete Structures
By
Mahwish Waqas
9/27/2020 CSC102 - Discrete Structures 2
Lecture Outline
• Applications of Propositional Logic
• Logic and Bit Operations
• Logical Equivalence
9/27/2020 CSC102 - Discrete Structures 3
¬(p ∨ q)
9/27/2020 CSC102 - Discrete Structures 7
• Let p = I go to Harry’s
• q = I go to the country.
• r = I will go shopping.
9/27/2020 CSC102 - Discrete Structures 9
• Let p = I go to Harry’s
• q = I go to the country.
• r = I will go shopping.
• If p or q then not r
(p ∨ q) → ¬r
9/27/2020 CSC102 - Discrete Structures 10
• a only if c or not f
a → (c ∨¬f ).
9/27/2020 CSC102 - Discrete Structures 14
Exercise
• Let p and q be the propositions “The election is decided”
and “The votes have been counted,” respectively. Express
each of these compound propositions as an English
sentence.
1. ¬p
2. p ∨ q
3. ¬p ∧ q
4. q → p
5. ¬q → ¬p
6. ¬p → ¬q
7. p ↔ q
8. ¬q ∨ (p ∧ q)
9/27/2020 CSC102 - Discrete Structures 15
System Specifications
• System and Software engineers take requirements in
English and express them in a precise specification
language based on logic.
System Specifications
• System and Software engineers take requirements in
English and express them in a precise specification
language based on logic.
Consistency
1. 𝒑 ∨ 𝒒 2. ¬𝒑 3. 𝒑 → 𝒒
Reasoning
• An assignment of truth values that makes all three
specifications true must have p false to make ¬𝑝 true.
• Because we want 𝑝 ∨ 𝑞 to be true but 𝑝 must be false, q
must be true.
• Because 𝑝 → 𝑞 is true when 𝑝 is false and 𝑞 is true
• we conclude that these specifications are consistent
• Let us do it with truth table now
9/27/2020 CSC102 - Discrete Structures 21
1. 𝒑 ∨ 𝒒 2. ¬𝒑 3. 𝒑 → 𝒒
9/27/2020 CSC102 - Discrete Structures 22
1. 𝒑 ∨ 𝒒 2. ¬𝒑 3. 𝒑 → 𝒒
4. ¬𝒒
Inconsistent
9/27/2020 CSC102 - Discrete Structures 23
Propositional Equivalence
• An important type of step used in a mathematical
argument is the replacement of a statement with another
statement with the same truth value
p ¬p p ∨ ¬p p ∧ ¬p
T F T F
F T T F
Logical Equivalence
• Compound propositions that have the same truth values
in all possible cases are called logically equivalent.
Logical Equivalence
p q p→q p q ¬p ¬p q
T T T T T F T
T F F T F F F
F T T F T T T
F F T F F T T
9/27/2020 CSC102 - Discrete Structures 29
Logical Equivalence
• Converse
The proposition q → p is converse of p → q.
• Contrapositive
The contrapositive of p → q is the proposition ¬q →¬p.
• Inverse
The proposition ¬p →¬q is called the inverse of p → q.
9/27/2020 CSC102 - Discrete Structures 30
Logical Equivalence
Logical Equivalence
Equivalence Name
p∧T≡p Identity laws
p∨F≡p
p∨T≡T Domination laws
p∧F≡F
p∨p≡p Idempotent laws
p∧p≡p
¬(¬p) ≡ p Double negation law
p∨q≡q∨p Commutative laws
p∧q≡q∧p
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r) Associative laws
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) Distribution Laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r)
9/27/2020 CSC102 - Discrete Structures 32
Logical Equivalence
Equivalence Name
¬(p ∧ q) ≡ ¬p ∨¬q De Morgan’s laws
¬(p ∨ q) ≡ ¬p ∧¬q
p ∨ (p ∧ q) ≡ p Absorption laws
p ∧ (p ∨ q) ≡ p
p ∨¬p ≡ T Negation laws
p ∧¬p ≡ F
9/27/2020 CSC102 - Discrete Structures 33
Logical Equivalence
• Distributive: p (q r) (p q) (p r)
p q r q r p (q r) (p q) (p r) (p q) (p
r)
T T T T T T T T
T T F F T T T T
T F T F T T T T
T F F F T T T T
F T T T T T T T
F T F F F T F F
F F T F F F T F
F F F F F F F F
9/27/2020 CSC102 - Discrete Structures 34
(p q) q
(p q) q DeMorgan’s
(p q) q Double negation
p (q q) Associative
p q Idempotent
•
9/27/2020 CSC102 - Discrete Structures 37
Proof:
(p q) → q
(p q) q Implication
( p q) q De Morgan
p ( q q) Associative
p T Negation
T Dominations
9/27/2020 CSC102 - Discrete Structures 38
[p (p → q)] → q
[p (p q)] → q Substitution for →
[(p p) (p q)] → q Distributive
[ F (p q)] → q Negation
(p q) → q Identity
(p q) q Substitution for →
(p q) q DeMorgan’s
p (q q ) Associative
p T Negation
T Domination
9/27/2020 CSC102 - Discrete Structures 39
Chapter Reading
• Chapter 1, Kenneth H. Rosen, Discrete Mathematics and
Its Applications, Section 1.2,1.3
9/27/2020 CSC102 - Discrete Structures 41