From 2f42f90f7e3505ce973ba46cb16b028acad9f27d Mon Sep 17 00:00:00 2001 From: boris Date: Thu, 6 Feb 2025 13:22:51 +0000 Subject: [PATCH] vault backup: 2025-02-06 13:22:51 --- .DS_Store | Bin 18436 -> 18436 bytes .obsidian/workspace.json | 38 ++--- ...rmational Proofs in Propositional Logic.md | 154 ++++++++++++++++++ Client Server Systems/.DS_Store | Bin 8196 -> 8196 bytes Client Server Systems/PHPStorm Repo | 2 +- 5 files changed, 174 insertions(+), 20 deletions(-) create mode 100644 AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md diff --git a/.DS_Store b/.DS_Store index bed4cefa6ff52655badd2fe44357170fa16aed64..15d5d9084eb3257a7b9bc5df3b2897d2f5eb6c52 100644 GIT binary patch delta 27 icmZpfz}PZ@aYK?ChmoOyj)IYi#pE6>`^_uWq7?ymH3)71 delta 22 dcmZpfz}PZ@aYK?Cv!%K52af;% diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 0c5dae2..e493ad2 100755 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -27,12 +27,12 @@ "state": { "type": "markdown", "state": { - "file": "Penetration Testing/Exploitation Assignment/Discovery.md", + "file": "AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md", "mode": "source", "source": false }, "icon": "lucide-file", - "title": "Discovery" + "title": "Week 21 - Transformational Proofs in Propositional Logic" } } ], @@ -216,23 +216,29 @@ }, "active": "ae922dd6b04c31a4", "lastOpenFiles": [ + "Penetration Testing/Exploitation Assignment/Discovery.md", + "AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md", + "AI & Data Mining/Week 21", + "Client Server Systems/PHPStorm Repo/students.sqlite", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/Views/index.phtml", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/index.php", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/Views/page1.phtml", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/Views/studentISv1.phtml", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/studentISv1.php", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/Models/StudentsDataSet.php", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/Models/studentISv1.php", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/Models/StudentData.php", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/images/new_uos_logo.jpg", + "Client Server Systems/PHPStorm Repo/ajax_workshop_2/fonts/glyphicons-halflings-regular.svg", + "Client Server Systems/PHPStorm Repo/images/new_uos_logo.jpg", + "Client Server Systems/PHPStorm Repo/fonts/glyphicons-halflings-regular.svg", + "Client Server Systems/PHPStorm Repo/ajax_workshop_1/favicon.png", "images/Pasted image 20250131145917.png", "images/Pasted image 20250131144439.png", "images/Pasted image 20250131144425.png", - "Penetration Testing/Exploitation Assignment/Discovery.md", - "Penetration Testing/Exploitation Assignment", "AI & Data Mining/Week 20/Week 20 - Intro to Propositional Logic.md", "AI & Data Mining/Week 20/Chapter 20 Tutorial - Introduction to Propositional Logic.md", "AI & Data Mining/Week 20/Propositional Logic Examples.md", - "Networking and Security/Week 20/hashcat-exercise/test-dict", - "Networking and Security/Week 20/hashcat-exercise/view-sample-password.sh", - "Networking and Security/Week 20/hashcat-exercise/crack-these-please-sha512", - "Networking and Security/Week 20/hashcat-exercise/crack-these-please-sha256", - "Networking and Security/Week 20/hashcat-exercise/crack-these-please-md5", - "Networking and Security/Week 20/hashcat-exercise/500_passwords.txt", - "Networking and Security/Week 20/hashcat-exercise/50-crack-these-please", - "Networking and Security/Week 20/hashcat-exercise", - "Networking and Security/Week 20/hashcat-exercise-files.zip", "AI & Data Mining/Week 19/Timeline of History.md", "Penetration Testing/Week 20/Week 20 - Web Attacks.md", "CWC 3 - Fit for Trade.md", @@ -247,12 +253,6 @@ "Penetration Testing/Week 19/AI Summary.md", "Penetration Testing/Week 19/Week 19 - Buffer Overflow.md", "Client Server Systems/PHPStorm Repo/php-s1/MVCtemplate-23-24/images/new_uos_logo.jpg", - "Client Server Systems/PHPStorm Repo/php-s1/MVCtemplate-23-24/fonts/glyphicons-halflings-regular.svg", - "Client Server Systems/PHPStorm Repo/php-s1/workshop6/images/new_uos_logo.jpg", - "Client Server Systems/PHPStorm Repo/php-s1/workshop6/fonts/glyphicons-halflings-regular.svg", - "Client Server Systems/PHPStorm Repo/php-s1/workshop5/images/new_uos_logo.jpg", - "Client Server Systems/PHPStorm Repo/php-s1/workshop5/fonts/glyphicons-halflings-regular.svg", - "Client Server Systems/PHPStorm Repo/php-s1/workshop4/images/new_uos_logo.jpg", "AI & Data Mining/Week 18/Week 18 - What AI?????.md", "Networking and Security/Week 18/Workshop.md", "Data Structures/AI Notes/Stack.md", diff --git a/AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md b/AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md new file mode 100644 index 0000000..26168ea --- /dev/null +++ b/AI & Data Mining/Week 21/Week 21 - Transformational Proofs in Propositional Logic.md @@ -0,0 +1,154 @@ +**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). \ No newline at end of file diff --git a/Client Server Systems/.DS_Store b/Client Server Systems/.DS_Store index 153bc8932620508f209d8afe1eb33e604f50bb77..1c648b4ca1647c8467991a4f0deb46e7c11337f0 100644 GIT binary patch delta 21 ccmZp1XmQveB+OxCXrQBDWMZ*dO86BI06?4txc~qF delta 21 ccmZp1XmQveB+OxHZmgqVVq&^kO86BI06|^_$N&HU diff --git a/Client Server Systems/PHPStorm Repo b/Client Server Systems/PHPStorm Repo index 2238305..f64a9ea 160000 --- a/Client Server Systems/PHPStorm Repo +++ b/Client Server Systems/PHPStorm Repo @@ -1 +1 @@ -Subproject commit 2238305d6545c6fb92f00f8f24f72e8c1c1d7cbb +Subproject commit f64a9eadbe156cf56f5d51a259d2fe33c2421d2c