Discrete Structures Lecture 1
Discrete Structures Lecture 1
(Discrete Mathematics)
Lecture-1
Introduction to
Propositional Logic
Instructor: Mr. Obaid ur Rehman
Email : ourehman@[Link]
Course Objectives
• Deep understanding of discrete structures used in
Computer Science
• Developing problem solving and analytical skills
• Developing algorithmic and computational skills
• 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)
•
Logical Operator - Negation
• Logical operators are defined by truth tables –tables
which give the output of the operator in the right-most
column.
• Here is the truth table for negation:
p
T F
P
F T
Logical Operator - Negation
•
Logical Operator - Conjunction
•
Logical Operator - Conjunction
• Truth Table
p q
T T T
T F F
F T F
F F F
Logical Operator - Conjunction
•
Logical Operator - Conjunction
• Hamza’s PC has more than 16 GB free hard disk space,
and the processor in Hamza’s PC runs faster than 1 GHz.
p q
T T T
T F T
F T T
F F F
Logical Operator - Disjunction
•
Example
•
Logical Operator – Exclusive Or
•
p q
T T F
T F T
F T T
F F F
Logical Operator – Exclusive Or
•
Exclusive or Versus Inclusive or
(Disjunction)
• 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
•
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
p
p q ¬q p∧q (p ∨¬q) → (p ∧ q)
∨¬q
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
↔ 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