1 / 31

Lecture 2: Logic

Lecture 2: Logic. Methods of proof. Methods of proof. หัวข้อบรรยาย Definitions of theorem Rules of inference Formal proofs. Basic Definitions. Definition: theorem คือประโยคที่เป็นผลสรุปอย่างสมเหตุสมผล สามารถพิสูจน์ได้จาก ทฤษฎีอื่นๆ axioms (ประโยคที่เรายอมรับว่าจริง) และ

kueng
Download Presentation

Lecture 2: Logic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 2: Logic Methods of proof

  2. Methods of proof • หัวข้อบรรยาย • Definitions of theorem • Rules of inference • Formal proofs 310213 Discrete Structures:Logic

  3. Basic Definitions • Definition: theoremคือประโยคที่เป็นผลสรุปอย่างสมเหตุสมผล • สามารถพิสูจน์ได้จาก • ทฤษฎีอื่นๆ • axioms(ประโยคที่เรายอมรับว่าจริง) และ • หลักการให้เหตุผล(rules of inference) • lemma(not a “lemon”) คือ 'pre-theorem' หรือประโยคที่เป็นผลสรุปที่สามารถนาไปพิสูจน์ทฤษฎีบท • corollaryคือ 'post-theorem' หรือผลสรุปที่เป็นผลมาจากทฤษฎีบท 310213 Discrete Structures:Logic

  4. Rules of Inference • สามารถใช้ tautologies ที่กล่าวมาแล้วมาช่วยในการให้เหตุผลได้ • การให้เหตุผลจะเขียนในรูป H1 H2 ...  Hn C • เมื่อ Hi เรียกว่า hypotheses • C เรียกว่า conclusion 310213 Discrete Structures:Logic

  5. Rules of Inference • กฏการให้เหตุผลสามารถเขียนอยู่ในรูป : H 1 H2 . . Hn C 310213 Discrete Structures:Logic

  6. Rules of Inference • ตัวอย่าง tautology : P ( P  Q) Qเขียนได้เป็น P P Q Q • หมายความว่าเมื่อ P เป็นจริงและ P Qเป็นจริงจะสรุปได้ว่า Qเป็นจริง • กฏการให้เหตุผลข้อนี้เรียกว่าmodusponens หรือ law of detachment 310213 Discrete Structures:Logic

  7. Rules of Inference 310213 Discrete Structures:Logic

  8. Rules of Inference 310213 Discrete Structures:Logic

  9. Formal Proofs • สมมุติว่าสมมุติฐาน ( hypotheses) เป็นจริง • ใช้กฎการให้เหตุผลหรือประพจน์ที่สมมูลกัน(logical equivalences) เพื่อแสดงให้ได้ว่าผลสรุปเป็นจริง 310213 Discrete Structures:Logic

  10. ตัวอย่าง • ถ้าม้าบินได้หรือวัวกินหญ้าแล้วยุงเป็นนกสวยงาม ถ้ายุงเป็นนกสวยงามแล้วไก่ขัน แต่ไก่ไม่ขัน ดังนั้นวัวไม่กินหญ้า • กำหนดตัวแปรแทนดังนี้: • A - วัวกินหญ้า • F - ม้าบินได้ • M - ยุงเป็นนกสวยงาม • P -ไก่ขัน 310213 Discrete Structures:Logic

  11. ตัวอย่าง • เขียนเป็นรูปสัญลักษณ์ดังนี้ 1. (F  A)  M 2. M  P 3.  P   A • ใช้สมมุติฐานจากข้อ1, 2, และ 3. และ rules of inference พิสูจน์ได้ดังนี้ 310213 Discrete Structures:Logic

  12. ตัวอย่าง(2) Assertion Reasons 1.(F  A)  MHypothesis 1. 2.M PHypothesis 2. 3.(F  A)  P steps 1 , 2 , hypothetical syll. 4. PHypothesis 3. 5.  (F  A) steps 3, 4 and modus tollens 6. F Astep 5 , DeMorgan 7. A Fstep 6, commutativity of 'and' 8. Astep 7, simplification 310213 Discrete Structures:Logic

  13. Rules of Inference for Quantifiers xP(x) P(c) Universal Instantiation (UI) ________________________________________ P(c) เมื่อ c เป็นค่าใดๆใน Universe xP(x) Universal Generalization (UG) ________________________________________ P(c) สำหรับ c บางตัวใน Universe xP(x) Existential Generalization (EG) ________________________________________ xP( x) P(c) Existential Instantiation (EI) 310213 Discrete Structures:Logic

  14. ตัวอย่าง • Every man has two legs. John Smith is a man. Therefore, John Smith has two legs. • กำหนดเป็น predicates ดังนี้ M(x) : x is a man L(x) : x has two legs J : John Smith 310213 Discrete Structures:Logic

  15. ตัวอย่าง(ต่อ) เขียนในรูปสัญลักษณ์ของประพจน์ได้ดังนี้ 1. x[M(x)  L(x)] 2. M( J ) L( J) พิสูจน์ 1.x[M(x) L(x)] Hypothesis 1 2.M( J ) L(J ) step 1 and UI 3.M(J) Hypothesis 2 4. L( J) steps 2 and 3 ,modus ponens 310213 Discrete Structures:Logic

  16. Methods of Proof • การพิสูจน์ทฤษฎีบท จะอยู่ในรูป P → Q • P อาจจะอยู่ในรูป conjunction ของสมมุติฐาน • ต้องแสดงให้ได้ว่า P→ Q เป็นจริง • วิธีการพิสูจน์มีหลายวิธีเช่น : • Trivial proof. • Direct proof. • Indirect proof. • Proof by contradiction. 310213 Discrete Structures:Logic

  17. Trivial Proof • Trivial proof: • ถ้าเราทราบว่า Q เป็นจริง จะได้ว่า P Q เป็นจริงเสมอ • ตัวอย่าง • ถ้าฝนตกวันนี้แล้วเซตว่างเป็นสับเซตของทุกเซต • ประพจน์นี้เป็นจริง ขึ้นกับค่าความจริงของ P • ตัวอย่าง • ถ้าเราทราบว่าสมมุติฐาน P เป็นเท็จแล้ว P Qจะเป็นจริงเสมอ (vacuouslytrue) • ตัวอย่าง • ถ้าฉันรวยและจนแล้วพระจันทร์ขึ้นทางทิศตะวันตก • (P  P) Q • ซึ่งสมมุติฐาน contradiction ดังนั้น Q จะเป็นจริง 310213 Discrete Structures:Logic

  18. Direct Proof • กำหนดสมมุติฐานเป็นจริง • ใช้หลักการให้เหตุผล(rules of inference) axioms และ logical equivalences เพื่อสรุปให้ได้ว่าผลสรุปเป็นจริง 310213 Discrete Structures:Logic

  19. Direct Proof(2) • ตัวอย่าง จงพิสูจน์ว่า ถ้า n เป็นจำนวนเต็มคี่แล้ว n2 เป็นจำนวนเต็มคี่ พิสูจน์ สมมุติให้ n เป็นจำนวนเต็มคี่ n = 2k + 1 เมื่อ k เป็นจำนวนเต็ม n2 = (2k + 1 )2 =4 k2 + 4k + 1 = 2(2 k2 + 2k) + 1 ดังนั้น n2 เป็นจำนวนเต็มคี่ 310213 Discrete Structures:Logic

  20. Indirect Proof • Indirect proof: • จากกฎของ contrapositive จะได้ว่า P→Q ⇔¬Q→¬P • เป็น direct proof โดยใช้ contrapositive • ให้ผลของ P Q เป็นเท็จ (Q เป็นจริง) • ใช้ rules of inference, axioms และlogical equivalences แสดงให้ได้ว่า P เป็นเท็จ 310213 Discrete Structures:Logic

  21. Indirect Proof (2) • ตัวอย่าง จงพิสูจน์ว่า ถ้า 3n +2 เป็นจำนวนเต็มคี่แล้ว n เป็นจำนวนเต็มคี่ • พิสูจน์ 310213 Discrete Structures:Logic

  22. Proof by contradiction or reductio ad absurdum • มี 2 กรณี คือ 1. พิสูจน์ว่า Q เป็นจริง วิธีการ • สมมุติให้ผลสรุป Q เป็นเท็จ • พยายามหาข้อความที่เป็น contradiction ที่อยู่ในรูป P P ซึ่งจะทำให้เกิด Q0 ซึ่ง contrapositive ของประโยคข้างต้นคือ 1Q ซึ่งจะได้ว่า Q ต้องเป็นจริง 310213 Discrete Structures:Logic

  23. Proof by contradiction (2) 2 พิสูจน์ว่า P→Q เป็นจริงโดยใช้วิธีหาข้อขัดแย้ง วิธีการ การพิสูจน์ประโยค P  Q เป็นจริงโดยใช้วิธีหาข้อขัดแย้ง ต้องสมมุติให้  (P  Q) เป็นจริง แต่ (P  Q ) (P  Q ) (P) Q  P Q ดังนั้นต้องสมมุติให้ P Q เป็นจริงแล้วหาข้อขัดแย้งในรูป R R ให้ได้ จึงสรุปได้ว่า P  Q 310213 Discrete Structures:Logic

  24. ตัวอย่าง • ตัวอย่างจงพิสูจน์ว่า √2 เป็นจำนวนอตรรกยะ แนวคิด ถ้าให้ p : √2 เป็นจำนวนอตรรกยะ  p : √2 เป็นจำนวนตรรกยะ พิสูจน์ สมมติให้ เป็นจำนวนตรรกยะ √2 = n/m ; n , m Z และ ห.ร.ม. ของ n และ m เป็น 1 2 = n2 /m2 n2 = 2m2 …………(1) จะได้ว่า ถ้า n2 เป็นเลขคู่แล้วจะได้ว่า n เป็นเลขคู่ n = 2t ; t Є Z 310213 Discrete Structures:Logic

  25. ตัวอย่าง แทนค่าใน (1) :- (2t)2 = 2m2 m2 = 2t2 จะได้ว่า m2 เป็นเลขคู่ ดังนั้น m เป็นเลขคู่ จะได้ว่า n และ m เป็นเลขคู่ซึ่งขัดแย้งกับที่กำหนดไว้ในตอนแรกว่า ห.ร.ม. ของ n และ m เป็น 1ดังนั้น √2 เป็นจำนวนตรรกยะไม่จริง นั่นคือ √2 เป็นจำนวนตรรกยะไม่จริง 310213 Discrete Structures:Logic

  26. ตัวอย่าง จงพิสูจน์ว่า ถ้า 3n +2 เป็นจำนวนเต็มคี่แล้ว n เป็นจำนวนเต็มคี่ พิสูจน์ 310213 Discrete Structures:Logic

  27. Disproof byCounterexample • จากประโยค xP(x) xP(x ). • ต้องการแสดงว่า xP(x ) เป็นจริง (หรือ xP(x) เป็นเท็จ ดังนั้นต้องหา c ซึ่งทำให้ P(c) เป็นจริง หรือ P(c) เป็นเท็จ • ในกรณีนี้ c เรียกว่า counterexampleของประโยค xP(x) 310213 Discrete Structures:Logic

  28. ตัวอย่าง • จงตรวจสอบว่า P  Q  P  Q หรือไม่ถ้าจริงให้พิสูจน์ แต่ถ้าไม่จริงให้ยกตัวอย่าง คำตอบ ไม่จริง เช่น P มีค่าความจริงเป็น F, Q มีค่าความจริงเป็น F จะได้ว่า P  Q มีค่าความจริงเป็น T แต่  P  Q มีค่าความจริงเป็น F 310213 Discrete Structures:Logic

  29. Fallacies • Fallacies คือกฎการให้เหตุผลที่ไม่ถูกต้อง • ตัวอย่างของ fallacies ที่พบบ่อยๆ • The Fallacy of Affirming the Consequent • การให้เหตุผลที่เขียนเป็นรูปสัญลักษณ์ของประพจน์ดังนี้ • P Q • Q • P • หรือ [(P Q )  Q ]  Pซึ่งไม่เป็น tautology ดังนั้นการให้เหตุผลไม่ถูกต้อง 310213 Discrete Structures:Logic

  30. Fallacies • The Fallacy of Denying the Antecedent (or the hypothesis) • การให้เหตุผลที่เขียนเป็นรูปสัญลักษณ์ของประพจน์ดังนี้ P Q P Q • หรือ [(P Q) P] Qซึ่งไม่เป็น tautology ดังนั้นการให้เหตุผลไม่ถูกต้อง 310213 Discrete Structures:Logic

  31. Fallacies • Begging the question or circular reasoning • เป็นเหตุการณ์ที่เกิดขึ้นโดยเราใช้ความจริงของประโยคที่กำลังพิสูจน์มาอ้างอิงในการพิสูจน์ตัวเอง • ตัวอย่าง จงแสดงว่าx 2 เป็นจำนวนคู่แล้ว x เป็นจำนวนคู่ พิสูจน์ x 2 เป็นจำวนคู่แล้ว x 2 = 2k สำหรับบาง k บางตัว ดังนั้น x = 2t สำหรับบาง t บางตัว ดังนั้น x เป็นจำนวนคู่ 310213 Discrete Structures:Logic

More Related