Set Theory in Computer Science a Gentle Introduction to Mathematical Modeling
Total Page:16
File Type:pdf, Size:1020Kb
Set Theory in Computer Science A Gentle Introduction to Mathematical Modeling Jose´ Meseguer University of Illinois at Urbana-Champaign Urbana, IL 61801, USA c Jose´ Meseguer, 2008–2010; all rights reserved. August 23, 2010 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 . 42 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 . 60 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 Binary Relations on a Set 71 8.1 Directed and Undirected Graphs . 71 8.2 Transition Systems and Automata . 73 8.3 Relation Homomorphisms and Isomorphisms . 74 8.4 Orders . 75 8.5 Sups and Infs, Complete Posets, Lattices, and Fixpoints . 78 8.6 Equivalence Relations and Quotients . 81 3 8.7 Constructing Z and Q ..................................... 84 9 Sets Come in Different Sizes 87 9.1 Cantor’s Theorem . 87 9.2 The Schroeder-Bernstein Theorem . 88 10 I-Indexed Sets 89 10.1 I-Indexed Sets are Surjective Functions . 89 10.2 Constructing I-Indexed Sets from other I-Indexed Sets . 94 10.3 I-Indexed Relations and Functions . 95 11 From I-Indexed Sets to Sets, and the Axiom of Choice 97 11.1 Some Constructions Associating a Set to an I-Indexed Set . 97 11.2 The Axiom of Choice . 102 12 Well-Founded Relations, and Well-Founded Induction and Recursion 107 12.1 Well-Founded Relations . 107 12.1.1 Constructing Well-Founded Relations . 108 12.2 Well-Founded Induction . 109 12.3 Well-Founded Recursion . 110 12.3.1 Examples of Well-Founded Recursion . 110 12.3.2 Well-Founded Recursive Definitions: Step Functions . 111 12.3.3 The Well-Founded Recursion Theorem . 113 13 Cardinal Numbers and Cardinal Arithmetic 115 13.1 Cardinal Arithmetic . 116 13.2 The Integers and the Rationals are Countable . 119 13.3 The Continuum and the Continuum Hypothesis . 121 13.3.1 Peano Curves . 122 13.3.2 The Continuum Hypothesis . 122 14 Classes, Intensional Relations and Functions, and Replacement 125 14.1 Classes . 125 14.1.1 Theorems are Assertions about Classes . 128 14.2 Intensional Relations . 129 14.3 Intensional Functions . 131 14.3.1 Typing Intensional Functions . 132 14.3.2 Computing with Intensional Functions . 133 14.3.3 Dependent and Polymorphic Types . 134 14.4 The Axiom of Replacement . 135 15 Well Orders, Ordinals, Cardinals, and Transfinite Constructions 139 15.1 Well-Ordered Sets . 139 15.2 Ordinals . 141 15.2.1 Ordinals as Transitive Sets . 143 15.2.2 Successor and Limit Ordinals . 143 15.2.3 Ordinal Arithmetic . 145 15.3 Transfinite Induction . 146 15.4 Transfinite Recursion . 147 15.4.1 α-Recursion . 148 15.4.2 Simple Intensional Recursion . 149 15.4.3 Transfinite Recursion . 150 15.5 Well-Orderings, Choice, and Cardinals . 152 15.5.1 Cardinals . 153 15.5.2 More Cardinal Arithmetic . 155 4 15.5.3 Regular, Singular, and Inaccessible Cardinals . 156 16 Well-Founded Sets and The Axiom of Foundation 157 16.1 Well-Founded Sets from the Top Down . 157 16.1.1 3-Induction . 159 16.2 Well-Founded Sets from the Bottom Up . 160 16.3 The Axiom of Foundation . 162 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 [20]) 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 [45], 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 scientifically. This is particularly true in mathematics. One of the crowning scientific achievements of the 20th century was the development of set theory as a pre- cise language for all of mathematics, thanks to the efforts of Cantor, Dedekind, Frege, Peano, Russell and Whitehead, Zermelo, Fraenkel, Skolem, Hilbert, von Neumann, Godel,¨ Bernays, Cohen, and others. This achievement has been so important and definitive that it led David Hilbert to say, already in 1925, that “no one will drive us from the paradise which Cantor created for us” (see [45], 367–392, pg. 376). It was of 7 course possible to think mathematically before set theory, but in a considerably more awkward and quite restricted way, because the levels of generality, rigor and abstraction made possible by set theory are much greater than at any other previous time. In fact, many key mathematical concepts we now take for granted, such a those of an abstract group or a topological space, could only be formulated after set theory, precisely because the language needed to conceive and articulate those concepts was not available before. Set theory is not really the only rigorous mathematical language. The languages of set theory and of mathematical logic were developed together, so that, as a mathematical discipline, set theory is a branch of mathematical logic. Technically, as we shall see shortly, we can view the language of set theory as a special.