DS Ch1 Propositional
DS Ch1 Propositional
Chapter 1
Logics Contents
Propositional Logic
Contents
Propositional Logic
References
1 Propositional Logic
2 References
1.2
Logics
Logic
Nguyen An Khuong et.
al.
Definition (Averroes)
Contents
The tool for distinguishing between the true and the false. Propositional Logic
References
1.3
Logics
Applications in Computer Science
Nguyen An Khuong et.
al.
Contents
Propositional Logic
1.4
Logics
Propositional Logic
Nguyen An Khuong et.
al.
Contents
Definition Propositional Logic
Examples
1.5
Logics
Examples
Nguyen An Khuong et.
al.
Contents
Examples (Which of these are propositions?)
Propositional Logic
1.6
Logics
Notations
Nguyen An Khuong et.
al.
Contents
Propositional Logic
References
1.7
Logics
Operators
Nguyen An Khuong et.
al.
Contents
Propositional Logic
Negation - ”Phủ định”: ¬p References
p ¬p
T F
F T
1.8
Logics
Operators
Nguyen An Khuong et.
al.
Contents
Conjunction - ”Hội”: p ∧ q Disjunction - ”Tuyển”: p ∨ q
Propositional Logic
“p and q” “p or q” References
p q p∧q p q p∨q
T T T T T T
T F F T F T
F T F F T T
F F F F F F
1.9
Logics
Operators
Nguyen An Khuong et.
al.
Contents
References
p⊕q “if p, then q”
“p or q (but not both)”
p q p→q
p q p⊕q T T T
T T F T F F
T F T F T T
F T T F F T
F F F
If it rains, the pavement will be
wet.
1.10
Logics
More Expressions for Implication p → q
Nguyen An Khuong et.
al.
Contents
• p implies q References
• p is sufficient for q
• q if p
• p only if q
• q unless ¬p
• If you get 100% on the final, you will get 10 grade.
• If you feel asleep this afternoon, then 2 + 3 = 5.
1.11
Logics
Conditional Statements From p → q
Nguyen An Khuong et.
al.
Contents
Propositional Logic
References
• q → p (converse - đảo)
• ¬q → ¬p (contrapositive - phản đảo)
• Prove that only contrapositive have the same truth table with
p→q
1.12
Logics
Contents
Exercise
Propositional Logic
What are the converse and contrapositive of the following References
conditional statement
“If he plays online games too much, his girlfriend leaves him.”
1.13
Logics
Biconditionals
Nguyen An Khuong et.
al.
p↔q
Contents
“p if and only if q” Propositional Logic
References
p q p↔q
T T T
T F F
F T F
F F T
1.14
Logics
Translating Natural Sentences
Nguyen An Khuong et.
al.
Contents
Propositional Logic
Exercise
References
I will buy a new phone only if I have enough money to buy iPhone
4 or my phone is not working.
• p → (q ∨ ¬r)
1.15
Logics
Translating Natural Sentences
Nguyen An Khuong et.
al.
Contents
Propositional Logic
References
Exercise
He will not run the red light if he sees the police unless he is too
risky.
1.16
Logics
Construct Truth Table
Nguyen An Khuong et.
al.
Contents
Exercise
Propositional Logic
Construct the truth table of the compound proposition References
(p ∨ ¬q) → (p ∧ q).
p q ¬q p ∨ ¬q p∧q (p ∨ ¬q) → (p ∧ 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
1.17
Logics
Applications
Nguyen An Khuong et.
al.
Contents
Propositional Logic
References
• System specifications
• “When a user clicked on Help button, a pop-up will be shown
up”
• Boolean search
• type “dai hoc bach khoa” in Google
• means “dai AND hoc AND bach AND khoa”
1.18
Logics
Applications (cont.)
Nguyen An Khuong et.
al.
Contents
Propositional Logic
• Logic puzzles References
1.19
Logics
Tautology and Contradiction
Nguyen An Khuong et.
al.
Definition Contents
Propositional Logic
A compound proposition that is always true (false) is called a
References
tautology (contradiction).
• Tautology: hằng đúng
• Contradiction: hằng sai
Example
• p ∨ ¬p (tautology)
• p ∧ ¬p (contradiction)
1.20
Logics
Logical Equivalences
Nguyen An Khuong et.
al.
Contents
Propositional Logic
References
Definition
The compound compositions ϕ and ψ are called logically
equivalent if ϕ ↔ ψ is a tautology, denoted ϕ ≡ ψ.
Example
Show that ¬(p ∨ q) and ¬p ∧ ¬q are logically equivalent.
1.21
Logics
Logical Equivalences
Nguyen An Khuong et.
al.
Contents
References
p∨F ≡ p Luật đồng nhất
p∨T ≡ T Domination laws
p∧F ≡ F Luật nuốt
p∨p ≡ p Idempotent laws
p∧p ≡ p Luật lũy đẳng
¬(¬p) ≡ p Double negation law
Luât phủ định kép
1.22
Logics
Logical Equivalences
Nguyen An Khuong et.
al.
Propositional Logic
p∧q ≡ q∧p Luật giao hoán
References
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r) Associative laws
(p ∧ q) ∧ r ≡ p ∧ (q ∧ r) Luật kết hợp
p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r) Distributive laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) Luật phân phối
¬(p ∧ q) ≡ ¬p ∨ ¬q De Morgan’s law
¬(p ∨ q) ≡ ¬p ∧ ¬q Luật De Morgan
p ∨ (p ∧ q) ≡ p Absorption laws
p ∧ (p ∨ q) ≡ p Luật hút thu
1.23
Logics
Logical Equivalences
Nguyen An Khuong et.
al.
Contents
Propositional Logic
Equivalence References
p ∨ ¬p ≡ T
p ∧ ¬p ≡ F
(p → q) ∧ (p → r) ≡ p → (q ∧ r)
(p → r) ∧ (q → r) ≡ (p ∨ q) → r
(p → q) ∨ (p → r) ≡ p → (q ∨ r)
(p → r) ∨ (q → r) ≡ (p ∧ q) → r
p↔q ≡ (p → q) ∧ (q → p)
1.24
Logics
Constructing New Logical Equivalences
Nguyen An Khuong et.
al.
Example
Show that ¬(p ∨ (¬p ∧ q)) and ¬p ∧ ¬q are logically equivalent by
Contents
developing a series of logical equivalences. Propositional Logic
References
Solution
1.25
Logics
References
Nguyen An Khuong et.
al.
Contents
Propositional Logic
References
• Discrete Mathematics and its Applications (8th Edition) by
Ken Rosen: Sections 1.1, 1.2, 1.3
• Mathematics for Computer Science by Eric Lehman, F.
Thomson Leighton, and Albert R. Meyer: Sections 1.1, 1.2,
3.1, 3.4, 3.5
• Discrete Mathematics with Ducks by Sarah-Marie Belcastro.
1.26