Set Theory in Computer Science a Gentle Introduction to Mathematical Modeling I
Total Page:16
File Type:pdf, Size:1020Kb
Set Theory in Computer Science A Gentle Introduction to Mathematical Modeling I Jose´ Meseguer University of Illinois at Urbana-Champaign Urbana, IL 61801, USA c Jose´ Meseguer, 2008–2010; all rights reserved. February 28, 2011 2 Contents 1 Motivation 7 2 Set Theory as an Axiomatic Theory 11 3 The Empty Set, Extensionality, and Separation 15 3.1 The Empty Set . 15 3.2 Extensionality . 15 3.3 The Failed Attempt of Comprehension . 16 3.4 Separation . 17 4 Pairing, Unions, Powersets, and Infinity 19 4.1 Pairing . 19 4.2 Unions . 21 4.3 Powersets . 24 4.4 Infinity . 26 5 Case Study: A Computable Model of Hereditarily Finite Sets 29 5.1 HF-Sets in Maude . 30 5.2 Terms, Equations, and Term Rewriting . 33 5.3 Confluence, Termination, and Sufficient Completeness . 36 5.4 A Computable Model of HF-Sets . 39 5.5 HF-Sets as a Universe for Finitary Mathematics . 43 5.6 HF-Sets with Atoms . 47 6 Relations, Functions, and Function Sets 51 6.1 Relations and Functions . 51 6.2 Formula, Assignment, and Lambda Notations . 52 6.3 Images . 54 6.4 Composing Relations and Functions . 56 6.5 Abstract Products and Disjoint Unions . 59 6.6 Relating Function Sets . 62 7 Simple and Primitive Recursion, and the Peano Axioms 65 7.1 Simple Recursion . 65 7.2 Primitive Recursion . 67 7.3 The Peano Axioms . 69 8 Case Study: The Peano Language 71 9 Binary Relations on a Set 73 9.1 Directed and Undirected Graphs . 73 9.2 Transition Systems and Automata . 75 9.3 Relation Homomorphisms and Simulations . 76 9.4 Orders . 78 3 9.5 Sups and Infs, Complete Posets, Lattices, and Fixpoints . 81 9.6 Equivalence Relations and Quotients . 84 9.7 Constructing Z and Q ..................................... 88 10 Case Study: Fixpoint Semantics of Recursive Functions and Lispy 91 10.1 Recursive Function Definitions in a Nutshell . 92 10.2 Fixpoint Semantics of Recursive Function Definitions . 93 10.3 The Lispy Programming Language . 96 11 Sets Come in Different Sizes 97 11.1 Cantor’s Theorem . 97 11.2 The Schroeder-Bernstein Theorem . 98 12 I-Indexed Sets 99 12.1 I-Indexed Sets are Surjective Functions . 99 12.2 Constructing I-Indexed Sets from other I-Indexed Sets . 104 12.3 I-Indexed Relations and Functions . 105 13 From I-Indexed Sets to Sets, and the Axiom of Choice 107 13.1 Some Constructions Associating a Set to an I-Indexed Set . 107 13.2 The Axiom of Choice . 112 14 Well-Founded Relations, and Well-Founded Induction and Recursion 117 14.1 Well-Founded Relations . 117 14.1.1 Constructing Well-Founded Relations . 118 14.2 Well-Founded Induction . 119 14.3 Well-Founded Recursion . 120 14.3.1 Examples of Well-Founded Recursion . 120 14.3.2 Well-Founded Recursive Definitions: Step Functions . 121 14.3.3 The Well-Founded Recursion Theorem . 123 15 Cardinal Numbers and Cardinal Arithmetic 125 15.1 Cardinal Arithmetic . 126 15.2 The Integers and the Rationals are Countable . 129 15.3 The Continuum and the Continuum Hypothesis . 131 15.3.1 Peano Curves . 132 15.3.2 The Continuum Hypothesis . 132 16 Classes, Intensional Relations and Functions, and Replacement 135 16.1 Classes . 135 16.1.1 Mathematical Theorems are Assertions about Classes . 138 16.2 Intensional Relations . 139 16.3 Intensional Functions . 141 16.3.1 Typing Intensional Functions . 142 16.3.2 Computing with Intensional Functions . 143 16.3.3 Dependent and Polymorphic Types . 144 16.4 The Axiom of Replacement . 145 17 Case Study: Dependent and Polymorphic Types in Maude 149 17.1 Dependent Types in Maude . 149 17.2 Polymorphic-and-Dependent Types in Maude . 152 17.3 Definability Issues . 154 4 18 Well Orders, Ordinals, Cardinals, and Transfinite Constructions 155 18.1 Well-Ordered Sets . 155 18.2 Ordinals . 157 18.2.1 Ordinals as Transitive Sets . 159 18.2.2 Successor and Limit Ordinals . 159 18.2.3 Ordinal Arithmetic . 161 18.3 Transfinite Induction . 162 18.4 Transfinite Recursion . 163 18.4.1 α-Recursion . 164 18.4.2 Simple Intensional Recursion . 165 18.4.3 Transfinite Recursion . 166 18.5 Well-Orderings, Choice, and Cardinals . 168 18.5.1 Cardinals . 169 18.5.2 More Cardinal Arithmetic . 171 18.5.3 Regular, Singular, and Inaccessible Cardinals . 172 19 Well-Founded Sets and The Axiom of Foundation 173 19.1 Well-Founded Sets from the Top Down . 173 19.1.1 3-Induction . 175 19.2 Well-Founded Sets from the Bottom Up . 176 19.3 The Axiom of Foundation . 178 5 6 Chapter 1 Motivation “... we cannot improve the language of any science without at the same time improving the science itself; neither can we, on the other hand, improve a science, without improving the language or nomenclature which belongs to it.” (Lavoisier, 1790, quoted in Goldenfeld and Woese [23]) I found the inadequacy of language to be an obstacle; no matter how unwieldly the expressions I was ready to accept, I was less and less able, as the relations became more and more complex, to attain the precision that my purpose required. This deficiency led me to the idea of the present ideography. ::: I believe that I can best make the relation of my ideography to ordinary language clear if I compare it to that which the microscope has to the eye. Because of the range of its possible uses and the versatility with which it can adapt to the most diverse circumstances, the eye is far superior to the microscope. Considered as an optical instrument, to be sure, it exhibits many imperfections, which ordinarily remain unnoticed only on account of its intimate connection with our mental life. But, as soon as scientific goals demand great sharpness of resolution, the eye proves to be insufficient. The microscope, on the other hand, is prefectly suited to precisely such goals, but that is just why it is useless for all others. (Frege, 1897, Begriffsschrift, in [52], 5–6) Language and thought are related in a deep way. Without any language it may become impossible to conceive and express any thoughts. In ordinary life we use the different natural languages spoken on the planet. But natural language, although extremely flexible, can be highly ambiguous, and it is not at all well suited for science. Imagine, for example, the task of professionally developing quantum mechanics (itself relying on very abstract concepts, such as those in the mathematical language of operators in a Hilbert space) in ordinary English. Such a task would be virtually impossible; indeed, ridiculous: as preposterous as trying to build the Eiffel tower in the Sahara desert with blocks of vanilla ice cream. Even the task of popularization, that is, of explaining informally in ordinary English what quantum mechanics is, is highly nontrivial, and must of necessity remain to a considerable extent suggestive, metaphorical, and fraught with the possibility of gross misunderstandings. The point is that without a precise scientific language it becomes virtually impossible, or at least enor- mously burdensome and awkward, to think.