LOGIC for Mathematics and Computer Science Stanley N. Burris Department of Pure Mathematics University of Waterloo Prentice Hall Upper Saddle River, New Jersey 07458
Contents Preface The Flow of Topics xi xvii Part I Quantifier-Free Logics 1 Chapter 1 From Aristotle to Boole 3 1.1 Sophistry 3 1.2 The Contributions of Aristotle 5 1.3 The Algebra of Logic 10 1.4 The Method of Boole, and Venn Diagrams 20 1.4.1 Checking for Validity 24 1.4.2 Finding the Most General Conclusion 26 1.5 Historical Remarks 29 Chapter 2 Propositional Logic 37 2.1 Propositional Connectives, Propositional Formulas, and Truth Tables 37 2.1.1 Defining Propositional Formulas 38 2.1.2 Truth Tables 40 2.2 Equivalent Formulas, Tautologies, and Contradictions 43 2.2.1 Equivalent Formulas 43 2.2.2 Tautologies 45 2.2.3 Contradictions 45 2.3 Substitution 46 2.4 Replacement 48 2.4.1 Induction Proofs on Formulas 49 2.4.2 The Main Result on Replacement 49 2.4.3 Simplification of Formulas 51 2.5 Adequate Connectives 52 V
vi Contents 2.5.1 The Adequacy of Standard Connectives 52 2.5.2 Proving Adequacy 53 2.5.3 Proving Inadequacy 55 2.6 Disjunctive and Conjunctive Forms 59 2.6.1 Rewrite Rules to Obtain Normal Forms 60 2.6.2 Using Truth Tables to Find Normal Forms 62 2.6.3 Uniqueness of Normal Forms 64 2.7 Valid Arguments, Tautologies, and Satisfiability 65 2.8 Compactness 75 2.8.1 The Compactness Theorem for Propositional Logic 75 2.8.2 Applications of Compactness 77 2.9 The Propositional Proof System PC 79 2.9.1 Simple Equivalences 79 2.9.2 The Proof System 82 2.9.3 Soundness and Completeness 85 2.9.4 Derivations with Premisses 86 2.9.5 Proving Theorems about h 91 2.9.6 Generalized Soundness and Completeness 93 2.10 Resolution 98 2.10.1 A Motivation 98 2.10.2 Clauses 101 2.10.3 Resolution 102 2.10.4 The Davis-Putnam Procedure 103 2.10.5 Soundness and Completeness for the DPP 107 2.10.6 Applications of the DPP 108 2.10.7 Soundness and Completeness for Resolution 110 2.10.8 Generalized Soundness and Completeness for Resolution 111 2.11 Horn Clauses 114 2.12 Graph Clauses 116 2.13 Pigeonhole Clauses 118 2.14 Historical Remarks 119 2.14.1 The Beginnings 120 2.14.2 Statement Logic and the Algebra of Logic 120 2.14.3 Frege's Work Ignored 122 2.14.4 Bertrand Russell Rescues Frege's Logic 123 2.14.5 The Influence of Principia 124 2.14.6 The Emergence of Truth Tables, Completeness 126 2.14.7 The Hilbert School of Logic 126 2.14.8 The Polish School of Logic 127
Contents VII 2.14.9 Other Propositional Proof Systems 2.14.10 Problems with Algorithms 2.14.11 Reduction to Propositional Logic 2.14.12 Testing for Satisfiability Chapter 3 Equational Logic 3.1 3.2 3.3 Interpretations and Algebras Terms Term Functions 3.3.1 Evaluation Tables 3.4 Equations 3.4.1 The Semantics of Equations 3.4.2 Classes of Algebras Defined by Equations 3.4.3 Three Very Basic Properties of Equations 3.5 3.6 3.7 3.8 Valid Arguments Substitution Replacement A Proof System for Equational Logic 3.8.1 Birkhoff's Rules 3.8.2 Is There a Strategy for Finding Equational Derivations? 3.9 3.10 Soundness Completeness 3.10.1 The Construction of Z n 3.10.2 The Proof of the Completeness Theorem 3.10.3 Valid Arguments Revisited 3.11 3.12 Chain Derivations Unification 3.12.1 Unifiers 3.12.2 A Unification Algorithm 3.12.3 Properties of Prefix Notation for Terms 3.12.4 Notation for Substitutions 3.12.5 Verification of the Unification Algorithm 3.12.6 Unification of Finitely Many Terms 3.13 Term Rewrite Systems (TRSs) 3.13.1 Definition of a TRS 3.13.2 Terminating TRSs 3.13.3 Normal Form TRSs 3.13.4 Critical Pairs 3.13.5 Critical Pairs Lemma 3.13.6 Terms as Strings 3.13.7 Confluence 128 129 130 130 133 134 140 145 145 149 149 153 158 161 168 171 175 175 178 183 183 183 184 185 187 189 190 191 196 198 201 206 207 208 209 211 214 223 225 228
viii Contents 3.14 Reduction Orderings 240 3.14.1 Definition of a Reduction Ordering 241 3.14.2 The Knuth-Bendix Orderings 242 3.14.3 Polynomial Orderings 247 3.15 The Knuth-Bendix Procedure 251 3.15.1 Finding a Normal Form TRS for Groups 252 3.15.2 A Formalization of the Knuth-Bendix Procedure 255 3.16 Historical Remarks 256 Chapter 4 Predicate Clause Logic 261 4.1 First-Order Languages without Equality 261 4.2 Interpretations and Structures 262 4.3 Clauses 264 4.4 Semantics 267 4.5 Reduction to Propositional Logic via Ground Clauses, and the Compactness Theorem for Clause Logic 272 4.5.1 Ground Instances 272 4.5.2 Satisfiable over an Algebra 274 4.5.3 The Herbrand Universe 277 4.5.4 Growth of the Herbrand Universe 278 4.5.5 Satisfiability over the Herbrand Universe 280 4.5.6 Compactness for Predicate Clause Logic without Equality 283 4.6 Resolution 284 4.6.1 Substitution 284 4.6.2 Opp-Unification 285 4.6.3 Resolution 286 4.6.4 Soundness and Completeness of Resolution 287 4.7 The Unification of Literals 288 4.7.1 Unifying Pairs of Literals 288 4.7.2 The Unification Algorithm for Pairs of Literals 290 4.7.3 Most General Unifiers of Finitely Many Literals 294 4.8 Resolution with most General Opp-Unifiers 298 4.8.1 Most General Opp-Unifiers 298 4.8.2 An Opp-Unification Algorithm 300 4.8.3 Resolution and Most General Opp-Unifiers 304 4.8.4 Soundness and Completeness with Most General Opp-Unifiers 305 4.9 Adding Equality to the Language 307
Contents IX 4.10 Reduction to Propositional Logic 308 4.10.1 Axiomatizing Equality 308 4.10.2 The Reduction 309 4.10.3 Compactness for Clause Logic with Equality 312 4.10.4 Soundness and Completeness 312 4.11 Historical Remarks 313 Part II Logic with Quantifiers 315 Chapter 5 First Order Logic: Introduction, and Fundamental Results on Semantics 317 5.1 The Syntax of First-Order Logic 318 5.2 First-Order Syntax for the Natural Numbers 320 5.3 The Semantics of First-Order Sentences in N 322 5.4 Other Number Systems 329 5.5 First-Order Syntax for (Directed) graphs 332 5.6 The Semantics of First-Order Sentences in (Directed) Graphs 334 5.7 Semantics for First-Order Logic 339 5.8 Equivalent Formulas 344 5.9 Replacement and Substitution 346 5.10 Prenex Form 349 5.11 Valid Arguments 352 5.12 Skolemizing 353 5.13 The Reduction of First-Order Logic to Predicate Clause Logic 356 5.14 The Compactness Theorem 362 5.15 Historical Remarks 365 Chapter 6 A Proof System for First Order Logic, and Gödel's Completeness Theorem 367 6.1 A Proof System 367 6.2 First Facts about Derivations 369 6.3 Herbrand's Deduction Lemma 371 6.4 Consistent Sets of Formulas 374 6.5 Maximal Consistent Sets of Formulas 374 6.6 Adding Witness Formulas to a Consistent Sentence 376
X Contents 6.7 Constructing a Model Using a Maximal Consistent Set of Formulas with Witness Formulas 377 6.8 Consistent Sets of Sentences Are Satisfiable 380 6.9 Gödel's Completeness Theorem 380 6.10 Compactness 381 6.11 Historical Remarks 381 Appendix A Appendix В A Simple Timetable of Mathematical Logic and Computing 385 The Dedekind-Peano Number System 391 Appendix С Writing Up an Inductive Definition or Proof 397 C.l Inductive definitions 397 C.2 Inductive proofs 398 Appendix D The FL Propositional Logic 401 Bibliography 409 Index 413