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 . 76 3 Proof Procedures for Propositional Logic . 83 3.1 Semantic Tableau . 85 3.1.1 Tableau: A Tree Structure for DNF . 86 3.1.2 α-Rules and β-Rules . 87 3.2 Deductive Systems . 90 3.2.1 Inference Rules and Proofs . 90 3.2.2 Hilbert Systems . 92 3.2.3 Natural Deduction . 94 3.2.4 Inference Graphs . 97 3.3 Resolution . 98 3.3.1 Resolution Rule . 98 3.3.2 Resolution Strategies . 101 3.3.3 Preserving Satisfiability . 103 3.3.4 Completeness of Resolution . 106 3.3.5 A Resolution-based Decision Procedure . 109 3.3.6 Clause Deletion Strategies . 110 3.4 Boolean Constraint Propagation (BCP) . 113 3.4.1 BCP: a Simplification Procedure . 113 3.4.2 BCP: a Decision Procedure for Horn Clauses . 115 3.4.3 Unit Resolution versus Input Resolution . 116 3.4.4 Head/Tail Literals for BCP . 118 3.5 Exercise Problems . 123 4 Propositional Satisfiability . 126 4.1 The DPLL Algorithm . 127 4.1.1 Recursive Version of DPLL . 127 4.1.2 All-SAT and Incremental SAT Solvers . 130 4.1.3 BCPw: Implementation of Watch Literals . 132 4.1.4 Iterative Implementation of DPLL . 134 4.2 Conflict-Driven Clause Learning (CDCL) . 136 4.2.1 Generating Clauses from Conflicting Clauses . 137 4.2.2 DPLL with CDCL . 138 4.2.3 Unsatisfiable Cores . 141 4.2.4 Random Restart . 142 4.2.5 Branching Heuristics for DPLL . 143 4.3 Use of SAT Solvers . 145 iv 4.3.1 Specify SAT Instances in DIMACS Format . 146 4.3.2 Sudoku Puzzle . 147 4.3.3 Latin Square Problems . 149 4.3.4 Graph Problems . 150 4.4 Local Search Methods and MaxSAT . 152 4.4.1 Local Search Methods for SAT . 152 4.4.2 2SAT vesus Max2SAT . 155 4.5 Maximum Satisfiability . 157 4.5.1 Weight MaxSAT and Hybrid MaxSAT . 157 4.5.2 The Branch-and-Bound Algorithm . 159 4.5.3 Simplification Rules and Lower Bound . 161 4.5.4 Use of Hybrid MaxSAT Solvers . 164 4.6 Exercise Problems . 166 5 First Order Logic . 170 5.1 Syntax of First Order Languages . 170 5.1.1 Terms and Formulas . 170 5.1.2 The Quantifiers . 174 5.1.3 Unsorted and Many-Sorted Logics . 176 5.2 Semantics . 178 5.2.1 Interpretation . 178 5.2.2 Models, Satisfiability, and Validity . 182 5.2.3 Entailment and Equivalence . 184 5.3 Proof Methods . 187 5.3.1 Semantic Tableau . 187 5.3.2 Natural Deduction . 190 5.4 Conjunctive Normal Form . 190 5.4.1 Prenex Normal Form . 191 5.4.2 Skolemization . 193 5.4.3 Skolemizing Non-Prenex Formulas . 196 5.4.4 Clausal Form . 197 5.4.5 Herbrand Models for CNF . 198 5.5 Exercise Problems . 200 6 Unification and Resolution . 204 6.1 Unification . 204 6.1.1 Substitutions and Unifiers . 204 6.1.2 Combining Substitutions . 206 6.1.3 Rule-Based Unification . 207 6.1.4 Practically Linear Time Unification . 210 6.2 Resolution . 217 6.2.1 The Resolution and Factoring Rules . 217 6.2.2 A Refutational Proof Procedure . 219 v 6.3 Ordered Resolution . 221 6.3.1 Simplification Orders . 221 6.3.2 Completeness of Ordered Resolution . 226 6.4 Prover9: A Resolution Theorem Prover . 228 6.4.1 Input Formulas to Prover9 . 228 6.4.2 Inference Rules and Options . 231 6.4.3 Simplification Orders in Prover9 . 234 6.5 Exercise Problems . 235 7 Equational Logic . 239 7.1 Equality of Terms . 239 7.1.1 Axioms of Equality . 240 7.1.2 Semantics of \=" . 241 7.1.3 Theory of Equations . 243 7.2 Rewrite Systems . 245 7.2.1 Rewrite Rules . 245 7.2.2 Termination of Rewrite Systems . 246 7.2.3 Confluence of Rewriting . 247 7.2.4 The Knuth-Bendix Completion Procedure . 249 7.3 Inductive Theorem Proving . 255 7.3.1 Inductive Theorems . 255 7.3.2 Structural Induction . 256 7.3.3 Induction on Two Variables . 258 7.3.4 Multi-Sort Algebraic Specifications . 259 7.4 Resolution with Equality . 262 7.4.1 Paramodulation . 262 7.4.2 Simplification Rules . 264 7.4.3 Equality in Prover9 . 266 7.5 Mace4: Finite Model Finding in FOL . 268 7.5.1 Use of Mace4 . 268 7.5.2 Finite Model Finding by SAT Solvers . 271 7.6 Exercise Problems . 274 8 Prolog: Programming in Logic . 276 8.1 Prolog's Working Principle . 276 8.1.1 Horn Clauses in Prolog . 276 8.1.2 Resolution Proofs in Prolog . ..
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages249 Page
-
File Size-