Files
G4G0-2/AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md
2025-02-06 13:22:51 +00:00

154 lines
5.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

**Notes on Slides and Exercises**
**Slide 0: Learning Objectives**
- Prove equivalence of formulae using truth tables.
- Remember and use laws of equivalence.
- Carry out a transformational proof.
**Slide 1: Contents**
- Why is propositional logic called Boolean logic/algebra?
- Using truth tables to prove two formulae are identical in meaning.
- A problem with truth tables.
- Laws of logic.
- Famous applications.
- Summary, reading and references.
**Slide 2: George Boole (1815-1864)**
- Son of a shoemaker, self-taught mathematician.
- Professed mathematics at Queens College, Cork, Ireland.
- Seminal work: attempted to apply algebraic and arithmetic principles to logic.
**Slide 3: Logical Equivalence (≡)**
- Two formulae are equivalent if they have identical truth values under all possible assignments.
- Example: p ≡ p p (Idempotence)
**Slide 4: Two Approaches to Logical Equivalence**
1. Truth tables
- Example: p ≡ ¬p (Negation)
2. Transformational proofs
- Uses laws of logic to prove equivalence.
**Slide 5: Logical Equivalence with One Variable**
- Truth table for p ≡ p p (Idempotence)
- T | T | T
F | F | F
**Slide 6: Logical Equivalence with Two Variables**
- Truth table for p q ≡ q p (Commutativity)
- T | T | T | T
F | T | T | T
T | F | T | F
F | F | F | F
**Slide 7: Exercise - De Morgan's First Law**
- Prove ¬(p ∧ q) ≡ ¬p ¬q using a truth table.
**Slide 8: Solution to Exercise**
- Truth table for ¬(p ∧ q) ≡ ¬p ¬q
- T | F | F | T | F | F | T | F | F | F
F | F | F | F | F | F | F | F | F | T
**Slide 9: Logical Equivalence with Three Variables**
- Truth table for (p q) r ≡ p (q r) (Associativity)
- Example: (2 × 3) × 4 = 2 × (3 × 4)
**Slide 10: A Problem with Truth Tables**
- Truth tables become increasingly tedious as the number of variables increases.
- n | Number of rows in truth table (2^n)
1 | 2
2 | 4
3 | 8
**Slide 11: Laws of Logic**
- Idempotence: p ≡ p p, p ≡ p ∧ p
- Commutativity: p q ≡ q p, p ∧ q ≡ q ∧ p
- Associativity: (p q) r ≡ p (q r), etc.
- Negation law: ¬¬p ≡ p
- Law of equivalence: p ⇔ q ≡ (p ⇒ q) ∧ (q ⇒ p)
- Law of implication: p ⇒ q ≡ ¬p q
- Contraposition Law: p ⇒ q ≡ ¬q ⇒ ¬p
- De Morgan's first law: ¬(p ∧ q) ≡ ¬p ¬q
- De Morgan's second law: ¬(p q) ≡ ¬p ∧ ¬q
**Slide 12: Proof of De Morgan's Second Law**
- Using laws of logic to prove ¬(p q) ≡ ¬p ∧ ¬q.
**Slide 13: Idempotence**
- Proof of p ∧ p ≡ p using laws of logic.
- p ∧ p ≡ ¬¬p ∧ ¬¬p (Negation law twice)
- ≡ ¬(¬p ¬p) (De Morgan's second law)
- ≡ ¬false (Law of contradiction)
- ≡ p (Simplification)
**Slide 14: Commutative Laws of Logic**
- Proof of p ∧ q ≡ q ∧ p using laws of logic.
- p ∧ q ≡ ¬¬p ∧ ¬¬q (Negation law twice)
- ≡ ¬(¬p ¬q) (De Morgan's second law)
- ≡ ¬(¬q ¬p) (Commutativity of )
- ≡ q ∧ p (Negation law twice)
**Slide 15: Associative Laws of Logic**
- Example: (a × b) × c ≡ a × (b × c)
**Slide 16: Distributive Laws of Logic**
- Example: a × (b + c) ≡ (a × b) + (a × c)
**Slide 17: T versus true and F versus false**
- T represents a formula is true, F represents it is false.
- Example: p ∧ true ≡ p (Law of simplification)
**Slide 18: Laws involving true and false**
- Law of excluded middle: p ¬p ≡ true
- Law of contradiction: p ∧ ¬p ≡ false
- Laws of simplification: p ∧ true ≡ p, p true ≡ true, p ∧ false ≡ false, p false ≡ p
**Slide 19: Two More Laws of Simplification**
- Proofs for:
- p (p ∧ q) ≡ p
- p ∧ (p q) ≡ p
**Slide 20: Transformational Proofs**
- Two implicit rules:
- Substitution Rule: Replace a sub-formula with an equivalent one without changing the meaning.
- Transitivity Rule: If p ≡ q and q ≡ r, then p ≡ r.
- Example: Modus Tollens (¬q ∧ (p ⇒ q) ⇒ ¬p)
- Proof using laws of logic.
**Slide 21: Exercise**
- Fill in the missing steps to prove (p q) ∧ (¬p q) ≡ q using transformational proofs.
- Solution:
- (p q) ∧ (¬p q)
- ≡ (q p) ∧ (¬p q) (Commutativity)
- ≡ q (p ∧ ¬p) (Distributive law)
- ≡ q false (Law of contradiction)
- ≡ q (Simplification)
**Slide 22: Example - Accommodation**
- Prove ¬p ⇒ (q r) ≡ (¬p ∧ ¬q) ⇒ r using transformational proofs.
- Solution:
- Proof using laws of logic.
**Slide 23: Famous Applications**
- Analysis of complex conditional commands in programming.
- Design of digital circuits.
- Algebraic approach to formal specifications in software engineering.
**Slide 24: Summary**
- Boole's system was the foundation for propositional logic.
- Two approaches to establishing equivalence:
- Truth tables (tedious with many variables)
- Transformational proofs (uses laws of logic)
- Summary slides on Boole's system, truth tables, and transformational proofs.
**Slide 25: Reading and References**
- Recommended textbook: Russell, S., & Norvig, P. (2022). Artificial Intelligence: A Modern Approach (4th ed.). Pearson.
- Additional references:
- Nissanke, M. (1999). Introductory Logic and Sets for Computer Scientists. Addison-Wesley.
- Gray, P. (1984). Logic, Algebra and Databases. John Wiley & Sons.
**Exercises:**
1. Prove the laws of idempotence, commutative, associative, and distributive using truth tables.
2. Prove De Morgan's laws using truth tables or transformational proofs.
3. Prove the laws involving true and false using truth tables or transformational proofs.
4. Prove the laws of simplification using truth tables or transformational proofs.
5. Prove the equivalence of two given formulae using transformational proofs (as demonstrated in slides 21 and 22).