- Logic is ”the study of reasoning”
Propositions
- A proposition (ประพจน์) is a declarative sentence that is either TRUE or FALSE, but no both.
- ประโยคบอกเล่าหรือประโยคปฏิเสธที่ เป็นจริงหรือเป็นเท็จอย่างใดอย่างหนึ่ง เท่านั้น!!
Compound Propositions
- We can build composite propositions from simpler propositions by using 5 connectives:
- and (∧), or (∨), not (¬), implies (→), if and only if (⟷)
Truth Tables
- The truth values of compound propositions can be described by truth tables
pTF¬pFT
pTTFFqTFTFp∧qTFFF
pTTFFqTFTFp∨qTTTF
Conditional Proposition
- p เป็น Condition part, hypothesis, antecedent, premise
- q เป็น Conclusion, consequence
pTTFFqTFTFp→qTFTT
- p→q can also be read as:
- “If p, then q”
- “q when p”
- “A sufficient condition for q is p”
- “A necessary condition for p is q”
Biconditional Proposition
pTTFFqTFTFp↔qTFFT
- Input เหมือนกันเป็น TRUE ต่างกันเป็น FALSE ตรงข้ามกับ XOR Gate นะ!!! ระวังจำสับสน
- p↔q can also be read as:
- “p is a necessary and sufficient condition for q”
- and sometimes written as “p iff q”
Logical Equivalence
- ประพจน์ p สมมูลกับ q เมื่อ p และ q มีค่าความจริงเหมือนกันทุกกรณี (ดูใน Truth Table) เขียนแทนด้วย “p ≡ q”
- Logically equivalent = Same in every possible combination
pTTTTFFFFqTTFFTTFFrTFTFTFTFp∨(q∧r)TTTTTFFF(p∨q)∧(p∨r)TTTTTFFFEquivalent?TTTTTTTT
- ปัญหาอยู่ตรงที่ว่า จะรู้ว่า Logcally equivalent กันเนี่ย ถ้ามีทั้งหมด 10 symbols ไม่ต้องเขียน Truth Table 210=1,024 แถวเลยหรอ?!!!
- เพราะว่า The size of the truth table grows “exponentially” as the number of symbols increases.
Basic Logical Equivalences (สมมูลที่สำคัญ ๆ)
Biconditional Law
p↔q≡(p→q)∧(q→p)
Implication Law
p→q≡¬p∨q
Contrapositive Law
p→q≡¬q→¬p
¬(p∧q)≡¬p∨¬q
¬(p∨q)≡¬p∧¬q
Associative Laws (The Grouping is Not Important)
- เครื่องหมาย ใน เหมือนกับ นอก!
p∨(q∨r)≡(p∨q)∨r
p∧(q∧r)≡(p∧q)∧r
- Check Link อีกทีว่าถูกต้องมั้ย
- เครื่องหมาย ใน ต่างกับ นอก!
p∨(q∧r)≡(p∨q)∧(p∨r)
p∧(q∨r)≡(p∧q)∨(p∧r)
Quantifications (ตัวบ่งปริมาณ)
Universal Quantification (∀)
- ∀x, P(x) is true, if P(x) is true for every x in D → to show, examine all objects
- ∀x, P(x) is false, if P(x) is false for at least one x in D → to show, give one counterexample
Existential Quantification (∃)
- ∃x, P(x) is true, if P(x) is true for at least one x in D → to show, give one example
- ∃x, P(x) is false, if P(x) is false for every x in D → to show, examine all objects
Generalized De Morgan’s Law
¬(∀x,P(x)) and ∃x,¬P(x) have the same truth values.
¬(∃x,P(x)) and ∀x,¬P(x) have the same truth values.
- ง่าย ๆ ก็คือกระจาย ¬ เข้าไปใน quantified statement นั่นเอง
Nested Quantifiers
- ง่าย ๆ ก็คือการมีประพจน์ มากกว่า 1 ตัว = 2 ตัว นั่นแหละ
| ∃x∃y[P(x,y)] | ==TRUE== เมื่อมี (x, y) อย่างน้อยหนึ่งคู่ที่ทำให้เงื่อนไขเป็นจริง | |
|---|
| ∃x∀y[P(x,y)] | ==TRUE== เมื่อ x หนึ่งตัวที่เมื่อนำไปจับคู่กับ y ทุกตัวแล้วเป็นจริง | False → Diffcult ให้ใช้ De Morgan’s Law |
| ∀x∃y[P(x,y)] | ==TRUE== เมื่อนำ x ทุกตัวไปจับคู่กับ y บางตัวแล้วเป็นจริง | |
| ∀x∀y[P(x,y)] | ==FALSE== ทันทีเมื่อพบข้อแย้งอย่างน้อยหนึ่งคู่ที่แทนแล้วไม่จริง | |