Applications in Computer ScienceDesign of computer circuits • Construction of computer programs • Verification of the correctness of programs • Constructing proofs automatically • Artificial intelligence
Trang 1Tran Vinh Tan
Contents Propositional Logic
Chapter 1
Logics
Discrete Mathematics I on 13 March 2012
Tran Vinh Tan
Trang 2Tran Vinh Tan
Contents Propositional LogicContents
1 Propositional Logic
Trang 3Tran Vinh Tan
Contents Propositional Logic
Logic
Definition (Averroes)
Definition (Penguin Encyclopedia)
Definition (Discrete Mathematics - Rosen)
Rules of logic are used to distinguish between valid and invalid
mathematical arguments
Trang 4Tran Vinh Tan
Contents Propositional Logic
Applications in Computer Science
• Artificial intelligence
Trang 5Tran Vinh Tan
Contents Propositional Logic
Propositional Logic
Definition
but not both
Examples
Trang 6Tran Vinh Tan
Contents Propositional Logic
Examples
Examples (Which of these are propositions?)
Trang 7Tran Vinh Tan
Contents Propositional LogicNotations
• Propositions are denoted byp, q,
• Thetruth value(”chân trị”) istrue(T) orfalse(F)
Trang 8Tran Vinh Tan
Contents Propositional Logic
Trang 9Tran Vinh Tan
Contents Propositional Logic
Trang 10Tran Vinh Tan
Contents Propositional Logic
Operators
Exclusive OR- Tuyển loại : p ⊕ q
“p or q (but not both)”
Trang 11Tran Vinh Tan
Contents Propositional Logic
More Expressions for Implication p → q
Trang 12Tran Vinh Tan
Contents Propositional LogicConditional Statements From p → q
p → q
Trang 13Tran Vinh Tan
Contents Propositional Logic
Exercise
conditional statement
“If he plays online games too much, his girlfriend leaves him.”
games too much
does not play online games too much
Trang 14Tran Vinh Tan
Contents Propositional Logic
• “p isnecessary and sufficientfor q”
• “if p then q, andconversely”
Trang 15Tran Vinh Tan
Contents Propositional Logic
Translating Natural Sentences
Exercise
Trang 16Tran Vinh Tan
Contents Propositional LogicTranslating Natural Sentences
Exercise
He will not run the red light if he sees the police unless he is too
risky
Trang 17Tran Vinh Tan
Contents Propositional Logic
Construct Truth Table
Trang 18Tran Vinh Tan
Contents Propositional Logic
• type “dai hoc bach khoa” in Google
• means “daiANDhocANDbachANDkhoa”
Trang 19Tran Vinh Tan
Contents Propositional Logic
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”?
• Bit operations
• 101010011is a bit string of length nine
Trang 20Tran Vinh Tan
Contents Propositional Logic
Tautology and Contradiction
Trang 21Tran Vinh Tan
Contents Propositional Logic
Trang 22Tran Vinh Tan
Contents Propositional Logic
Trang 23Tran Vinh Tan
Contents Propositional Logic
Trang 24Tran Vinh Tan
Contents Propositional Logic
Trang 25Tran Vinh Tan
Contents Propositional Logic
Constructing New Logical Equivalences
Example
developing a series of logical equivalences
Solution
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬(¬p ∧ q) by the second De Morgan law
≡ ¬p ∧ [¬(¬p) ∨ ¬q] by the first De Morgan law
≡ ¬p ∧ (p ∨ ¬q) by the double negation law
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q) by the second distributive law
≡ F ∨ (¬p ∧ ¬q) because ¬p ∧ p ≡ F
≡ ¬p ∧ ¬q by the identity law for F