Discrete Structures lecture 1
Discrete Structures lecture 1
(Discrete Mathematics)
Fall 2024
Lecture-1
Introduction
Propositional Logic
Instructor: Mr. Nazeer Muhammad
Office: C1-102
Email : [email protected]
Rules
• Notebook/Register
• I encourage class participation
• Mobile phones – Silent or switch off
• 75% Attendance (No Relaxation)
• Arrive on time in class
• If you do not understand a point, raise your hand and ask me to
explain or contact during office hours
• No disturbance!!!! No Misconduct!!!!
• REMEMBER: Your first priority must be your studies
Course Objectives
• Deep understanding of discrete structures used in
Computer Science
• Developing problem solving and analytical skills
• Developing algorithmic and computational skills
• Proof
Ability to understand and create mathematical
argument
• Example 1
• 2 + 2 = 4.
• Lahore is the capital of Pakistan.
• It is Sunday today.
• Ali is student of this class.
• Example 2
• What time is it?
• X + 1 = 2.
• Close the door.
• Read this carefully.
Propositional Logic
• Example
• p = “Islamabad is the capital of Pakistan”
• q = “17 is divisible by 3”
Propositional Logic
• The area of logic that deals with propositions is called the
Propositional Calculus or Propositional Logic.
• Examples
• “3 + 2 = 5” and “Lahore is a city in Pakistan”
• “The grass is green” or “ It is hot today”
Symbols for Logical Operators
Symbol Meaning
¬ Negation
∧ And, Conjunction
∨ Or, Disjunction
→ Implication
Bi-Conditional
Logical Operators (Logical connectives)
• Negation
• This just turns a false proposition to true and the opposite for a true
proposition.
• Symbol: ¬
• Let p is a proposition. The statement
“It is not the case that p.”
is another proposition, called the negation of p.
p ¬p
T F
P ¬P
F T
Logical Operator - Negation
• Example
The negation of p is
p q p∧q
T T T
T F F
F T F
F F F
Logical Operator - Conjunction
• Example
p q p∨q
T T T
T F T
F T T
F F F
Logical Operator - Disjunction
• Example
p q p⊕ q
T T F
T F T
F T T
F F F
Logical Operator – Exclusive Or
• Example
Let p = “Students who have taken calculus can take this
class.”
and q = “Students who have taken computer science can
take this class.”
• Examples
• If it is raining then it is cloudy.
Hypothesis Conclusion
• If you get 100% on the final, then you will get an A.
• If p then 2+2 = 4.
Logical Operator – Implication
• Truth Table
p q p→q
T T T
T F F
F T T
F F T
Logical Operator – Implication
• p implies q
• If p, q
• p only if q
• p is sufficient for q
• q if p
• q whenever p
• q is necessary for p
Implication - Example
p: you get 100% on the final
q: you will get an A
• p implies that q.
you get 100% on the final implies that you will get an A.
• If p, then q.
If you get 100% on the final, then that you will get an A.
• If p, q.
If you get 100% on the final, that you will get an A.
• p is sufficient for q.
Get 100% on the final is sufficient for getting an A.
• q if p.
you will get an A if you get 100% on the final.
• q unless ¬ p.
you will get an A unless you don’t get 100% on final.
Logical Operator – Implication
• 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.
Logical Operator – Implication
• Example
• Contrapositive
“If the home team does not win, then it is not raining.”
• Converse
“If the home team wins, then it is raining.”
• Inverse
“If it is not raining, then the home team does not win.”
Logical Operator – Bi-conditional
•p q corresponds to English “p if and only if q.”
• Symbol:
• The bi-conditional statement p q is true when p and q
have the same truth values, and is false otherwise.
• Bi-conditional statements are also called bi-implications.
• Alternatively, it means “(if p then q) and (if q then p)”
• Example
• “You can take the flight if and only if you buy a ticket.”
Logical Operator – Bi-conditional
• Truth Table
p q p q
T T T
T F F
F T F
F F T
Logical Operator – Bi-conditional
p: You can take flight
q: You buy a ticket
𝑝𝑝 𝑞𝑞
You can take flight if and only if you buy a ticket
What is the truth value when:
• you buy a ticket and you can take the flight ??
• 𝑇𝑇 𝑇𝑇 ≡ 𝑇𝑇
• you don’t buy a ticket and you can’t take the flight ??
• 𝐹𝐹 𝐹𝐹 ≡ 𝑇𝑇
• you buy a ticket but you can’t take the flight ??
• 𝑇𝑇 𝐹𝐹 ≡ 𝐹𝐹
• you can’t buy a ticket but can take the flight ??
• 𝐹𝐹 𝑇𝑇 ≡ 𝐹𝐹
Logical Operator – Bi-conditional
• “p if and only if q”
• “p is equivalent to q”
• “p is necessary and sufficient for q”
• “p iff q”
• “If p then q, and conversely”
Bi-conditional -Example
p: “You can take the flight”
q: “You buy a ticket”
p q:
You can take the flight if and only if you buy a ticket
The fact that you can take the flight is necessary and
sufficient for buying a ticket
Logical Operators Summary
T T F T T T
T F T T F F
F T F F F T
F F T T F F
Truth Table of Compound Propositions
• p → (¬q ∧ r )
p q r ¬q ¬q ∧ r p → (¬q ∧ r )
T T T F F F
T T F F F F
T F T T T T
T F F T F F
F T T F F T
F T F F F T
F F T T T T
F F F T F T
Precedence of Logical Operators
• Just as in algebra, operators have precedence
Operator Precedence
• Example
¬ 1
This means that
∧ 2
p ∨ q ∧ ¬r → s t ∨ 3
yields: (p ∨ (q ∧ (¬r)) → s) (t) → 4
5
Truth Tables
• Construct the truth table of following compound
propositions
• p →¬p
• p⊕p
• (q →¬p) (p q)
Chapter Reading
• Chapter 1, Kenneth H. Rosen, Discrete Mathematics and
Its Applications
Chapter Exercise ( For Practice)
• Question # 1, 2, 3, 4, 8, 9, 13, 24, 27, 28, 31, 32