LOGIC IN COMPUTER SCIENCE by Benji MO Some people are always critical of vague statements. I tend rather to be critical of precise statements. They are the only ones which can correctly be labeled wrong. { Raymond Smullyan August 2020 Supervisor: Professor Hantao Zhang TABLE OF CONTENTS Page LIST OF FIGURES . viii CHAPTER 1 Introduction to Logic . 1 1.1 Logic is Everywhere . 2 1.1.1 Statement or Proposition . 2 1.1.2 A Brief History of Logic . 4 1.2 Logical Fallacies in Arguments . 5 1.2.1 Formal Fallacies . 5 1.2.2 Informal Fallacies . 7 1.3 A Brief Review of Mathematical Logic . 13 1.3.1 Set Theory . 13 1.3.2 Model Theory . 21 1.3.3 Proof Theory . 22 1.3.4 Computability Theory . 25 1.4 Exercise Problems . 29 2 Propositional Logic . 32 2.1 Syntax . 32 2.1.1 Logical Operators . 32 2.1.2 Formulas . 34 2.2 Semantics . 36 2.2.1 Interpretations . 36 2.2.2 Models, Satisfiability, and Validity . 38 2.2.3 Equivalence . 40 2.2.4 Entailment . 43 2.2.5 Theorem Proving and the SAT Problem . 45 2.3 Normal Forms . 46 2.3.1 Negation Normal Form (NNF) . 48 2.3.2 Conjunctive Normal Form (CNF) . 49 2.3.3 Disjunctive Normal Form (DNF) . 51 2.3.4 Full DNF and Full CNF from Truth Table . 53 2.3.5 Binary Decision Diagram (BDD) . 54 2.4 Optimization Problems . 59 2.4.1 Minimum Set of Operators . 59 iii 2.4.2 Logic Minimization . 61 2.4.3 Maximum Satisfiability . 69 2.5 Using Propositional Logic . 70 2.5.1 Bitwise Operators . 70 2.5.2 Specify Problems in Propositional Logic . 72 2.6 Exercise Problems . 77 3 Proof Procedures for Propositional Logic . 85 3.1 Semantic Tableau . 87 3.1.1 Tableau: A Tree Structure for DNF . 88 3.1.2 α-Rules and β-Rules . 89 3.2 Deductive Systems . 92 3.2.1 Inference Rules and Proofs . 92 3.2.2 Hilbert Systems . 94 3.2.3 Natural Deduction . 96 3.2.4 Inference Graphs . 99 3.3 Resolution . 100 3.3.1 Resolution Rule . 100 3.3.2 Resolution Strategies . 103 3.3.3 Preserving Satisfiability . 105 3.3.4 Completeness of Resolution . 108 3.3.5 A Resolution-based Decision Procedure . 110 3.3.6 Clause Deletion Strategies . 112 3.4 Boolean Constraint Propagation (BCP) . 115 3.4.1 BCP: a Simplification Procedure . 115 3.4.2 BCP: a Decision Procedure for Horn Clauses . 117 3.4.3 Unit Resolution versus Input Resolution . 118 3.4.4 Head/Tail Literals for BCP . 120 3.5 Exercise Problems . 124 4 Propositional Satisfiability . 128 4.1 The DPLL Algorithm . 129 4.1.1 Recursive Version of DPLL . 129 4.1.2 All-SAT and Incremental SAT Solvers . 132 4.1.3 BCPw: Implementation of Watch Literals . 133 4.1.4 Iterative Implementation of DPLL . 136 4.2 Conflict-Driven Clause Learning (CDCL) . 138 4.2.1 Generating Clauses from Conflicting Clauses . 139 4.2.2 DPLL with CDCL . 140 4.2.3 Unsatisfiable Cores . 143 4.2.4 Random Restart . 144 4.2.5 Branching Heuristics for DPLL . 145 4.3 Use of SAT Solvers . 147 iv 4.3.1 Specify SAT Instances in DIMACS Format . 148 4.3.2 Sudoku Puzzle . 149 4.3.3 Latin Square Problems . 151 4.3.4 Graph Problems . 152 4.4 Local Search Methods and MaxSAT . 154 4.4.1 Local Search Methods for SAT . 154 4.4.2 2SAT vesus Max2SAT . 157 4.5 Maximum Satisfiability . 159 4.5.1 Weight MaxSAT and Hybrid MaxSAT . 159 4.5.2 The Branch-and-Bound Algorithm . 161 4.5.3 Simplification Rules and Lower Bound . 163 4.5.4 Use of Hybrid MaxSAT Solvers . 166 4.6 Exercise Problems . 168 5 First Order Logic . 172 5.1 Syntax of First Order Languages . 172 5.1.1 Terms and Formulas . 172 5.1.2 The Quantifiers . 176 5.1.3 Unsorted and Many-Sorted Logics . 178 5.2 Semantics . 180 5.2.1 Interpretation . 180 5.2.2 Models, Satisfiability, and Validity . 184 5.2.3 Entailment and Equivalence . 186 5.3 Proof Methods . 189 5.3.1 Semantic Tableau . 189 5.3.2 Natural Deduction . 192 5.4 Conjunctive Normal Form . 192 5.4.1 Prenex Normal Form . 193 5.4.2 Skolemization . 195 5.4.3 Skolemizing Non-Prenex Formulas . 198 5.4.4 Clausal Form . 199 5.4.5 Herbrand Models for CNF . 200 5.5 Exercise Problems . 202 6 Unification and Resolution . 206 6.1 Unification . 206 6.1.1 Substitutions and Unifiers . 206 6.1.2 Combining Substitutions . 208 6.1.3 Rule-Based Unification . 209 6.1.4 Practically Linear Time Unification . 212 6.2 Resolution . 219 6.2.1 The Resolution and Factoring Rules . 219 6.2.2 A Refutational Proof Procedure . 221 v 6.3 Ordered Resolution . 223 6.3.1 Simplification Orders . 223 6.3.2 Completeness of Ordered Resolution . 228 6.4 Prover9: A Resolution Theorem Prover . 230 6.4.1 Input Formulas to Prover9 . 230 6.4.2 Inference Rules and Options . 233 6.4.3 Simplification Orders in Prover9 . 236 6.5 Exercise Problems . 238 7 Equational Logic . 241 7.1 Equality of Terms . 241 7.1.1 Axioms of Equality . 242 7.1.2 Semantics of \=" . 243 7.1.3 Theory of Equations . 245 7.2 Rewrite Systems . 247 7.2.1 Rewrite Rules . 247 7.2.2 Termination of Rewrite Systems . 248 7.2.3 Confluence of Rewriting . 249 7.2.4 The Knuth-Bendix Completion Procedure . 251 7.3 Inductive Theorem Proving . 257 7.3.1 Inductive Theorems . 257 7.3.2 Structural Induction . 258 7.3.3 Induction on Two Variables . 260 7.3.4 Multi-Sort Algebraic Specifications . 261 7.4 Resolution with Equality . 264 7.4.1 Paramodulation . 264 7.4.2 Simplification Rules . 266 7.4.3 Equality in Prover9 . 268 7.5 Mace4: Finite Model Finding in FOL . 270 7.5.1 Use of Mace4 . 270 7.5.2 Finite Model Finding by SAT Solvers . 274 7.6 Exercise Problems . 276 8 Prolog: Programming in Logic . 278 8.1 Prolog's Working Principle . 278 8.1.1 Horn Clauses in Prolog . 278 8.1.2 Resolution Proofs in Prolog . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages317 Page
-
File Size-