Professional Documents
Culture Documents
Chapter 1
Logics
Discrete Structures for Computing on 13 March 2012
Contents
Propositional Logic
Logics
Contents
Contents
Propositional Logic
1 Propositional Logic
1.2
Logics
Logic
Definition (Averroes)
The tool for distinguishing between the true and the false.
Contents
Propositional Logic
1.3
Logics
Contents
Propositional Logic
1.4
Logics
Propositional Logic
Definition
Contents
Propositional Logic
Examples
Hanoi is the capital of Viet Nam.
New York City is the capital of USA.
1+1=2
2+2=3
1.5
Logics
Examples
Contents
Propositional Logic
1.6
Logics
Notations
Contents
Propositional Logic
1.7
Logics
Operators
Negation - Ph nh: p
Contents
Propositional Logic
T
F
F
T
1.8
Logics
Operators
Conjunction - Hi: p q
p and q
Disjunction - Tuyn: p q
p or q
Contents
Propositional Logic
pq
pq
T
T
F
F
T
F
T
F
T
F
F
F
T
T
F
F
T
F
T
F
T
T
T
F
1.9
Logics
Operators
Implication - Ko theo: p q
if p, then q
Contents
Propositional Logic
pq
pq
T
T
F
F
T
F
T
F
F
T
T
F
T
T
F
F
T
F
T
F
T
F
T
T
1.10
Logics
if p, then q
p implies q
p is sufficient for q
Contents
Propositional Logic
q if p
p only if q: "Ill go to the party only if I finish studying."
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
Contents
q p (converse - o)
Propositional Logic
q p (contrapositive - phn o)
Prove that contrapositive have the same truth table with
pq
1.12
Logics
Exercise
Contents
Propositional Logic
1.13
Logics
Biconditionals
pq
p if and only if q
Contents
pq
T
T
F
F
T
F
T
F
T
F
F
T
Propositional Logic
1.14
Logics
Exercise
I will buy a new phone only if I have enough money to buy iPhone
4 or my phone is not working.
Contents
Propositional Logic
1.15
Logics
Contents
Propositional Logic
Exercise
He will not run the red light if he sees the police unless he is too
risky.
1.16
Logics
Exercise
Contents
Propositional Logic
p q
pq
(p q) (p q)
T
T
F
F
T
F
T
F
F
T
F
T
T
T
F
T
T
F
F
F
T
F
T
F
1.17
Logics
Applications
System specifications
When a user clicked on Help button, a pop-up will be shown
up
Contents
Propositional Logic
Boolean search
type dai hoc bach khoa in Google
means dai AND hoc AND bach AND khoa
1.18
Logics
Applications (cont.)
Logic puzzles
There are two kinds of inhabitants on an island, knights, who
always tell the truth, and their opposites, knaves, who always
lie. You encounter two people A and B. What are A and B if
A says B is a knight and B says The two of us are
opposite types?
Contents
Propositional Logic
Bit operations
101010011 is a bit string of length nine.
1.19
Logics
Definition
Contents
Propositional Logic
Contradiction: mu thun
Example
p p (tautology)
p p (contradiction)
1.20
Logics
Logical Equivalences
Definition
Contents
Propositional Logic
Example
1.21
Logics
Logical Equivalences
pT
pF
p
p
Identity laws
Lut ng nht
pT
pF
T
F
Domination laws
Lut nut
pp
pp
p
p
Idempotent laws
Lut ly ng
(p)
Contents
Propositional Logic
1.22
Logics
Logical Equivalences
pq
pq
qp
qp
(p q) r
(p q) r
p (q r)
p (q r)
Associative laws
Lut kt hp
p (q r)
p (q r)
(p q) (p r)
(p q) (p r)
Distributive laws
Lut phn phi
(p q)
(p q)
p q
p q
De Morgans law
Lut De Morgan
p (p q)
p (p q)
p
p
Commutative laws
Lut giao hon
Contents
Propositional Logic
Absorption laws
Lut ht thu
1.23
Logics
Logical Equivalences
Equivalence
p p
p p
(p q) (p r)
(p r) (q r)
(p q) (p r)
(p r) (q r)
pq
Contents
T
F
p (q r)
(p q) r
p (q r)
(p q) r
(p q) (q p)
Propositional Logic
1.24
Logics
Example
Solution
(p (p q))
Propositional Logic
p (p q)
p [(p) q]
p (p q)
(p p) (p q)
F (p q)
because p p F
p q
1.25