the open logic textbuilds.openlogicproject.org/open-logic-complete.pdf · 2020-02-13 · the open...

907
THE OPEN LOGIC TEXT Complete Build Open Logic Project Revision: 666b46f (master) 2020-02-13 The Open Logic Text by the Open Logic Project is licensed under a Cre- ative Commons Attribu- tion 4.0 International Li- cense.

Upload: others

Post on 23-Mar-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

  • THE OPEN LOGIC TEXT

    Complete Build

    Open Logic Project

    Revision: 666b46f (master)2020-02-13

    The Open Logic Text bythe Open Logic Projectis licensed under a Cre-ative Commons Attribu-tion 4.0 International Li-cense.

    http://openlogicproject.org/https://github.com/OpenLogicProject/OpenLogichttp://openlogicproject.org/http://creativecommons.org/licenses/by/4.0/http://creativecommons.org/licenses/by/4.0/http://creativecommons.org/licenses/by/4.0/http://creativecommons.org/licenses/by/4.0/http://openlogicproject.org/

  • About the Open Logic Project

    The Open Logic Text is an open-source, collaborative textbook of formal meta-logic and formal methods, starting at an intermediate level (i.e., after an intro-ductory formal logic course). Though aimed at a non-mathematical audience(in particular, students of philosophy and computer science), it is rigorous.

    Coverage of some topics currently included may not yet be complete, andmany sections still require substantial revision. We plan to expand the text tocover more topics in the future. We also plan to add features to the text, suchas a glossary, a list of further reading, historical notes, pictures, better expla-nations, sections explaining the relevance of results to philosophy, computerscience, and mathematics, and more problems and examples. If you find anerror, or have a suggestion, please let the project team know.

    The project operates in the spirit of open source. Not only is the text freelyavailable, we provide the LaTeX source under the Creative Commons Attri-bution license, which gives anyone the right to download, use, modify, re-arrange, convert, and re-distribute our work, as long as they give appropriatecredit. Please see the Open Logic Project website at openlogicproject.org foradditional information.

    1

    https://github.com/OpenLogicProject/OpenLogic/wiki/Contributinghttp://openlogicproject.org/

  • Contents

    About the Open Logic Project 1

    I Naı̈ve Set Theory 21

    1 Sets 231.1 Extensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231.2 Subsets and Power Sets . . . . . . . . . . . . . . . . . . . . . . . 241.3 Some Important Sets . . . . . . . . . . . . . . . . . . . . . . . . . 261.4 Unions and Intersections . . . . . . . . . . . . . . . . . . . . . . 261.5 Pairs, Tuples, Cartesian Products . . . . . . . . . . . . . . . . . . 291.6 Russell’s Paradox . . . . . . . . . . . . . . . . . . . . . . . . . . 31Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32

    2 Relations 332.1 Relations as Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 332.2 Philosophical Reflections . . . . . . . . . . . . . . . . . . . . . . 352.3 Special Properties of Relations . . . . . . . . . . . . . . . . . . . 362.4 Equivalence Relations . . . . . . . . . . . . . . . . . . . . . . . . 372.5 Orders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382.6 Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402.7 Operations on Relations . . . . . . . . . . . . . . . . . . . . . . . 41Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41

    3 Functions 433.1 Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 433.2 Kinds of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . 453.3 Functions as Relations . . . . . . . . . . . . . . . . . . . . . . . . 473.4 Inverses of Functions . . . . . . . . . . . . . . . . . . . . . . . . 483.5 Composition of Functions . . . . . . . . . . . . . . . . . . . . . . 493.6 Partial Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . 50Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51

    2

  • CONTENTS

    4 The Size of Sets 524.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 524.2 Enumerations and Enumerable Sets . . . . . . . . . . . . . . . . 524.3 Cantor’s Zig-Zag Method . . . . . . . . . . . . . . . . . . . . . . 564.4 Pairing Functions and Codes . . . . . . . . . . . . . . . . . . . . 574.5 An Alternative Pairing Function . . . . . . . . . . . . . . . . . . 584.6 Non-enumerable Sets . . . . . . . . . . . . . . . . . . . . . . . . 604.7 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634.8 Equinumerosity . . . . . . . . . . . . . . . . . . . . . . . . . . . 644.9 Sets of Different Sizes, and Cantor’s Theorem . . . . . . . . . . 654.10 The Notion of Size, and Schröder-Bernstein . . . . . . . . . . . 674.11 Enumerations and Enumerable Sets . . . . . . . . . . . . . . . . 684.12 Non-enumerable Sets . . . . . . . . . . . . . . . . . . . . . . . . 694.13 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    5 Arithmetization 765.1 From N to Z . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765.2 From Z to Q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785.3 The Real Line . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 795.4 From Q to R . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 805.5 Some Philosophical Reflections . . . . . . . . . . . . . . . . . . . 825.6 Ordered Rings and Fields . . . . . . . . . . . . . . . . . . . . . . 835.7 The Reals as Cauchy Sequences . . . . . . . . . . . . . . . . . . 86Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90

    6 Infinite Sets 916.1 Hilbert’s Hotel . . . . . . . . . . . . . . . . . . . . . . . . . . . . 916.2 Dedekind Algebras . . . . . . . . . . . . . . . . . . . . . . . . . 926.3 Arithmetical Induction . . . . . . . . . . . . . . . . . . . . . . . 946.4 Dedekind’s “Proof” . . . . . . . . . . . . . . . . . . . . . . . . . 956.5 A Proof of Schröder-Bernstein . . . . . . . . . . . . . . . . . . . 97

    II Propositional Logic 99

    7 Syntax and Semantics 1017.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1017.2 Propositional Formulas . . . . . . . . . . . . . . . . . . . . . . . 1027.3 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1047.4 Valuations and Satisfaction . . . . . . . . . . . . . . . . . . . . . 1057.5 Semantic Notions . . . . . . . . . . . . . . . . . . . . . . . . . . 106Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107

    Release : 666b46f (2020-02-13) 3

  • CONTENTS

    8 Derivation Systems 1088.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1088.2 The Sequent Calculus . . . . . . . . . . . . . . . . . . . . . . . . 1108.3 Natural Deduction . . . . . . . . . . . . . . . . . . . . . . . . . . 1108.4 Tableaux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1128.5 Axiomatic Derivations . . . . . . . . . . . . . . . . . . . . . . . . 113

    9 The Sequent Calculus 1159.1 Rules and Derivations . . . . . . . . . . . . . . . . . . . . . . . . 1159.2 Propositional Rules . . . . . . . . . . . . . . . . . . . . . . . . . 1169.3 Structural Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 1179.4 Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1189.5 Examples of Derivations . . . . . . . . . . . . . . . . . . . . . . 1199.6 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 1239.7 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 1259.8 Derivability and the Propositional Connectives . . . . . . . . . 1269.9 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131

    10 Natural Deduction 13210.1 Rules and Derivations . . . . . . . . . . . . . . . . . . . . . . . . 13210.2 Propositional Rules . . . . . . . . . . . . . . . . . . . . . . . . . 13310.3 Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13410.4 Examples of Derivations . . . . . . . . . . . . . . . . . . . . . . 13510.5 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 13910.6 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 14010.7 Derivability and the Propositional Connectives . . . . . . . . . 14210.8 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    11 Tableaux 14811.1 Rules and Tableaux . . . . . . . . . . . . . . . . . . . . . . . . . 14811.2 Propositional Rules . . . . . . . . . . . . . . . . . . . . . . . . . 14911.3 Tableaux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15011.4 Examples of Tableaux . . . . . . . . . . . . . . . . . . . . . . . . 15111.5 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 15511.6 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 15711.7 Derivability and the Propositional Connectives . . . . . . . . . 15911.8 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

    12 Axiomatic Derivations 16512.1 Rules and Derivations . . . . . . . . . . . . . . . . . . . . . . . . 16512.2 Axiom and Rules for the Propositional Connectives . . . . . . . 167

    4 Release : 666b46f (2020-02-13)

  • CONTENTS

    12.3 Examples of Derivations . . . . . . . . . . . . . . . . . . . . . . 16712.4 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 16912.5 The Deduction Theorem . . . . . . . . . . . . . . . . . . . . . . . 17012.6 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 17212.7 Derivability and the Propositional Connectives . . . . . . . . . 17312.8 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174

    13 The Completeness Theorem 17513.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17513.2 Outline of the Proof . . . . . . . . . . . . . . . . . . . . . . . . . 17613.3 Complete Consistent Sets of Sentences . . . . . . . . . . . . . . 17713.4 Lindenbaum’s Lemma . . . . . . . . . . . . . . . . . . . . . . . . 17813.5 Construction of a Model . . . . . . . . . . . . . . . . . . . . . . . 17913.6 The Completeness Theorem . . . . . . . . . . . . . . . . . . . . 18013.7 The Compactness Theorem . . . . . . . . . . . . . . . . . . . . . 18013.8 A Direct Proof of the Compactness Theorem . . . . . . . . . . . 181Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182

    III First-order Logic 183

    14 Syntax and Semantics 18514.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18514.2 First-Order Languages . . . . . . . . . . . . . . . . . . . . . . . . 18614.3 Terms and Formulas . . . . . . . . . . . . . . . . . . . . . . . . . 18814.4 Unique Readability . . . . . . . . . . . . . . . . . . . . . . . . . 19014.5 Main operator of a Formula . . . . . . . . . . . . . . . . . . . . . 19214.6 Subformulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19314.7 Free Variables and Sentences . . . . . . . . . . . . . . . . . . . . 19414.8 Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19514.9 Structures for First-order Languages . . . . . . . . . . . . . . . 19714.10 Covered Structures for First-order Languages . . . . . . . . . . 19814.11 Satisfaction of a Formula in a Structure . . . . . . . . . . . . . . 19914.12 Variable Assignments . . . . . . . . . . . . . . . . . . . . . . . . 20314.13 Extensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20614.14 Semantic Notions . . . . . . . . . . . . . . . . . . . . . . . . . . 207Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

    15 Theories and Their Models 21115.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21115.2 Expressing Properties of Structures . . . . . . . . . . . . . . . . 21315.3 Examples of First-Order Theories . . . . . . . . . . . . . . . . . 21315.4 Expressing Relations in a Structure . . . . . . . . . . . . . . . . 216

    Release : 666b46f (2020-02-13) 5

  • CONTENTS

    15.5 The Theory of Sets . . . . . . . . . . . . . . . . . . . . . . . . . . 21715.6 Expressing the Size of Structures . . . . . . . . . . . . . . . . . . 219Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220

    16 Derivation Systems 22216.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22216.2 The Sequent Calculus . . . . . . . . . . . . . . . . . . . . . . . . 22416.3 Natural Deduction . . . . . . . . . . . . . . . . . . . . . . . . . . 22416.4 Tableaux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22616.5 Axiomatic Derivations . . . . . . . . . . . . . . . . . . . . . . . . 227

    17 The Sequent Calculus 22917.1 Rules and Derivations . . . . . . . . . . . . . . . . . . . . . . . . 22917.2 Propositional Rules . . . . . . . . . . . . . . . . . . . . . . . . . 23017.3 Quantifier Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 23117.4 Structural Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 23217.5 Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23217.6 Examples of Derivations . . . . . . . . . . . . . . . . . . . . . . 23417.7 Derivations with Quantifiers . . . . . . . . . . . . . . . . . . . . 23817.8 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 23917.9 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 24117.10 Derivability and the Propositional Connectives . . . . . . . . . 24217.11 Derivability and the Quantifiers . . . . . . . . . . . . . . . . . . 24317.12 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24417.13 Derivations with Identity predicate . . . . . . . . . . . . . . . . 24917.14 Soundness with Identity predicate . . . . . . . . . . . . . . . . . 250Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250

    18 Natural Deduction 25218.1 Rules and Derivations . . . . . . . . . . . . . . . . . . . . . . . . 25218.2 Propositional Rules . . . . . . . . . . . . . . . . . . . . . . . . . 25318.3 Quantifier Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 25418.4 Derivations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25518.5 Examples of Derivations . . . . . . . . . . . . . . . . . . . . . . 25618.6 Derivations with Quantifiers . . . . . . . . . . . . . . . . . . . . 26018.7 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 26318.8 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 26518.9 Derivability and the Propositional Connectives . . . . . . . . . 26718.10 Derivability and the Quantifiers . . . . . . . . . . . . . . . . . . 26818.11 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26818.12 Derivations with Identity predicate . . . . . . . . . . . . . . . . 27318.13 Soundness with Identity predicate . . . . . . . . . . . . . . . . . 274Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 275

    6 Release : 666b46f (2020-02-13)

  • CONTENTS

    19 Tableaux 27619.1 Rules and Tableaux . . . . . . . . . . . . . . . . . . . . . . . . . 27619.2 Propositional Rules . . . . . . . . . . . . . . . . . . . . . . . . . 27719.3 Quantifier Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . 27819.4 Tableaux . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27919.5 Examples of Tableaux . . . . . . . . . . . . . . . . . . . . . . . . 28019.6 Tableaux with Quantifiers . . . . . . . . . . . . . . . . . . . . . . 28419.7 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 28819.8 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 29019.9 Derivability and the Propositional Connectives . . . . . . . . . 29119.10 Derivability and the Quantifiers . . . . . . . . . . . . . . . . . . 29419.11 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29519.12 Tableaux with Identity predicate . . . . . . . . . . . . . . . . . . 29719.13 Soundness with Identity predicate . . . . . . . . . . . . . . . . . 298Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299

    20 Axiomatic Derivations 30020.1 Rules and Derivations . . . . . . . . . . . . . . . . . . . . . . . . 30020.2 Axiom and Rules for the Propositional Connectives . . . . . . . 30220.3 Axioms and Rules for Quantifiers . . . . . . . . . . . . . . . . . 30220.4 Examples of Derivations . . . . . . . . . . . . . . . . . . . . . . 30320.5 Derivations with Quantifiers . . . . . . . . . . . . . . . . . . . . 30420.6 Proof-Theoretic Notions . . . . . . . . . . . . . . . . . . . . . . . 30520.7 The Deduction Theorem . . . . . . . . . . . . . . . . . . . . . . . 30620.8 The Deduction Theorem with Quantifiers . . . . . . . . . . . . 30820.9 Derivability and Consistency . . . . . . . . . . . . . . . . . . . . 30920.10 Derivability and the Propositional Connectives . . . . . . . . . 31020.11 Derivability and the Quantifiers . . . . . . . . . . . . . . . . . . 31020.12 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31120.13 Derivations with Identity predicate . . . . . . . . . . . . . . . . 312Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313

    21 The Completeness Theorem 31421.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31421.2 Outline of the Proof . . . . . . . . . . . . . . . . . . . . . . . . . 31521.3 Complete Consistent Sets of Sentences . . . . . . . . . . . . . . 31721.4 Henkin Expansion . . . . . . . . . . . . . . . . . . . . . . . . . . 31821.5 Lindenbaum’s Lemma . . . . . . . . . . . . . . . . . . . . . . . . 32021.6 Construction of a Model . . . . . . . . . . . . . . . . . . . . . . . 32121.7 Identity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32321.8 The Completeness Theorem . . . . . . . . . . . . . . . . . . . . 32521.9 The Compactness Theorem . . . . . . . . . . . . . . . . . . . . . 32621.10 A Direct Proof of the Compactness Theorem . . . . . . . . . . . 32821.11 The Löwenheim-Skolem Theorem . . . . . . . . . . . . . . . . . 329

    Release : 666b46f (2020-02-13) 7

  • CONTENTS

    Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 329

    22 Beyond First-order Logic 33122.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33122.2 Many-Sorted Logic . . . . . . . . . . . . . . . . . . . . . . . . . . 33222.3 Second-Order logic . . . . . . . . . . . . . . . . . . . . . . . . . . 33322.4 Higher-Order logic . . . . . . . . . . . . . . . . . . . . . . . . . . 33722.5 Intuitionistic Logic . . . . . . . . . . . . . . . . . . . . . . . . . . 33922.6 Modal Logics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34322.7 Other Logics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345

    IV Model Theory 346

    23 Basics of Model Theory 34823.1 Reducts and Expansions . . . . . . . . . . . . . . . . . . . . . . 34823.2 Substructures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34923.3 Overspill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34923.4 Isomorphic Structures . . . . . . . . . . . . . . . . . . . . . . . . 35023.5 The Theory of a Structure . . . . . . . . . . . . . . . . . . . . . . 35123.6 Partial Isomorphisms . . . . . . . . . . . . . . . . . . . . . . . . 35223.7 Dense Linear Orders . . . . . . . . . . . . . . . . . . . . . . . . . 355Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 356

    24 Models of Arithmetic 35724.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35724.2 Standard Models of Arithmetic . . . . . . . . . . . . . . . . . . . 35824.3 Non-Standard Models . . . . . . . . . . . . . . . . . . . . . . . . 36024.4 Models of Q . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36124.5 Models of PA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36324.6 Computable Models of Arithmetic . . . . . . . . . . . . . . . . . 367Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368

    25 The Interpolation Theorem 37025.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37025.2 Separation of Sentences . . . . . . . . . . . . . . . . . . . . . . . 37025.3 Craig’s Interpolation Theorem . . . . . . . . . . . . . . . . . . . 37225.4 The Definability Theorem . . . . . . . . . . . . . . . . . . . . . . 374

    26 Lindström’s Theorem 37726.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37726.2 Abstract Logics . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37726.3 Compactness and Löwenheim-Skolem Properties . . . . . . . . 37926.4 Lindström’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . 380

    8 Release : 666b46f (2020-02-13)

  • CONTENTS

    V Computability 383

    27 Recursive Functions 38527.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38527.2 Primitive Recursion . . . . . . . . . . . . . . . . . . . . . . . . . 38627.3 Composition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38827.4 Primitive Recursion Functions . . . . . . . . . . . . . . . . . . . 38927.5 Primitive Recursion Notations . . . . . . . . . . . . . . . . . . . 39227.6 Primitive Recursive Functions are Computable . . . . . . . . . 39227.7 Examples of Primitive Recursive Functions . . . . . . . . . . . . 39327.8 Primitive Recursive Relations . . . . . . . . . . . . . . . . . . . 39627.9 Bounded Minimization . . . . . . . . . . . . . . . . . . . . . . . 39827.10 Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39827.11 Sequences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39927.12 Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40227.13 Other Recursions . . . . . . . . . . . . . . . . . . . . . . . . . . . 40327.14 Non-Primitive Recursive Functions . . . . . . . . . . . . . . . . 40427.15 Partial Recursive Functions . . . . . . . . . . . . . . . . . . . . . 40527.16 The Normal Form Theorem . . . . . . . . . . . . . . . . . . . . . 40727.17 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . . . . 40827.18 General Recursive Functions . . . . . . . . . . . . . . . . . . . . 409Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410

    28 Computability Theory 41128.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41128.2 Coding Computations . . . . . . . . . . . . . . . . . . . . . . . . 41228.3 The Normal Form Theorem . . . . . . . . . . . . . . . . . . . . . 41328.4 The s-m-n Theorem . . . . . . . . . . . . . . . . . . . . . . . . . 41428.5 The Universal Partial Computable Function . . . . . . . . . . . 41428.6 No Universal Computable Function . . . . . . . . . . . . . . . . 41528.7 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . . . . 41528.8 Comparison with Russell’s Paradox . . . . . . . . . . . . . . . . 41628.9 Computable Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 41828.10 Computably Enumerable Sets . . . . . . . . . . . . . . . . . . . 41828.11 Definitions of C. E. Sets . . . . . . . . . . . . . . . . . . . . . . . 41928.12 Union and Intersection of C.E. Sets . . . . . . . . . . . . . . . . 42128.13 Computably Enumerable Sets not Closed under Complement . 42228.14 Reducibility . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42328.15 Properties of Reducibility . . . . . . . . . . . . . . . . . . . . . . 42428.16 Complete Computably Enumerable Sets . . . . . . . . . . . . . 42528.17 An Example of Reducibility . . . . . . . . . . . . . . . . . . . . . 42628.18 Totality is Undecidable . . . . . . . . . . . . . . . . . . . . . . . 42728.19 Rice’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42828.20 The Fixed-Point Theorem . . . . . . . . . . . . . . . . . . . . . . 430

    Release : 666b46f (2020-02-13) 9

  • CONTENTS

    28.21 Applying the Fixed-Point Theorem . . . . . . . . . . . . . . . . 43328.22 Defining Functions using Self-Reference . . . . . . . . . . . . . 43428.23 Minimization with Lambda Terms . . . . . . . . . . . . . . . . . 435Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436

    VI Turing Machines 437

    29 Turing Machine Computations 43929.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43929.2 Representing Turing Machines . . . . . . . . . . . . . . . . . . . 44129.3 Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . 44529.4 Configurations and Computations . . . . . . . . . . . . . . . . . 44529.5 Unary Representation of Numbers . . . . . . . . . . . . . . . . . 44729.6 Halting States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44829.7 Combining Turing Machines . . . . . . . . . . . . . . . . . . . . 44929.8 Variants of Turing Machines . . . . . . . . . . . . . . . . . . . . 45029.9 The Church-Turing Thesis . . . . . . . . . . . . . . . . . . . . . 452Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452

    30 Undecidability 45430.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45430.2 Enumerating Turing Machines . . . . . . . . . . . . . . . . . . . 45630.3 The Halting Problem . . . . . . . . . . . . . . . . . . . . . . . . . 45630.4 The Decision Problem . . . . . . . . . . . . . . . . . . . . . . . . 45830.5 Representing Turing Machines . . . . . . . . . . . . . . . . . . . 45930.6 Verifying the Representation . . . . . . . . . . . . . . . . . . . . 46230.7 The Decision Problem is Unsolvable . . . . . . . . . . . . . . . . 466Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467

    VII Incompleteness 468

    31 Introduction to Incompleteness 47031.1 Historical Background . . . . . . . . . . . . . . . . . . . . . . . . 47031.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47431.3 Overview of Incompleteness Results . . . . . . . . . . . . . . . 47831.4 Undecidability and Incompleteness . . . . . . . . . . . . . . . . 480Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482

    32 Arithmetization of Syntax 48332.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48332.2 Coding Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . 48432.3 Coding Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48632.4 Coding Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . 488

    10 Release : 666b46f (2020-02-13)

  • CONTENTS

    32.5 Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48932.6 Derivations in LK . . . . . . . . . . . . . . . . . . . . . . . . . . 48932.7 Derivations in Natural Deduction . . . . . . . . . . . . . . . . . 49332.8 Axiomatic Derivations . . . . . . . . . . . . . . . . . . . . . . . . 497Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501

    33 Representability in Q 50333.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50333.2 Functions Representable in Q are Computable . . . . . . . . . . 50533.3 The Beta Function Lemma . . . . . . . . . . . . . . . . . . . . . 50633.4 Simulating Primitive Recursion . . . . . . . . . . . . . . . . . . 50933.5 Basic Functions are Representable in Q . . . . . . . . . . . . . . 51033.6 Composition is Representable in Q . . . . . . . . . . . . . . . . 51233.7 Regular Minimization is Representable in Q . . . . . . . . . . . 51433.8 Computable Functions are Representable in Q . . . . . . . . . . 51733.9 Representing Relations . . . . . . . . . . . . . . . . . . . . . . . 51833.10 Undecidability . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519

    34 Theories and Computability 52034.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52034.2 Q is C.e.-Complete . . . . . . . . . . . . . . . . . . . . . . . . . . 52034.3 ω-Consistent Extensions of Q are Undecidable . . . . . . . . . 52134.4 Consistent Extensions of Q are Undecidable . . . . . . . . . . . 52234.5 Axiomatizable Theories . . . . . . . . . . . . . . . . . . . . . . . 52334.6 Axiomatizable Complete Theories are Decidable . . . . . . . . 52334.7 Q has no Complete, Consistent, Axiomatizable Extensions . . . 52334.8 Sentences Provable and Refutable in Q are Computably Insep-

    arable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52434.9 Theories Consistent with Q are Undecidable . . . . . . . . . . . 52534.10 Theories in which Q is Intepretable are Undecidable . . . . . . 525

    35 Incompleteness and Provability 52735.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52735.2 The Fixed-Point Lemma . . . . . . . . . . . . . . . . . . . . . . . 52835.3 The First Incompleteness Theorem . . . . . . . . . . . . . . . . . 53035.4 Rosser’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . 53235.5 Comparison with Gödel’s Original Paper . . . . . . . . . . . . . 53335.6 The Derivability Conditions for PA . . . . . . . . . . . . . . . . 53435.7 The Second Incompleteness Theorem . . . . . . . . . . . . . . . 53535.8 Löb’s Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53735.9 The Undefinability of Truth . . . . . . . . . . . . . . . . . . . . . 540Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541

    Release : 666b46f (2020-02-13) 11

  • CONTENTS

    VIII Second-order Logic 542

    36 Syntax and Semantics 54436.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54436.2 Terms and Formulas . . . . . . . . . . . . . . . . . . . . . . . . . 54536.3 Satisfaction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54636.4 Semantic Notions . . . . . . . . . . . . . . . . . . . . . . . . . . 54836.5 Expressive Power . . . . . . . . . . . . . . . . . . . . . . . . . . 54836.6 Describing Infinite and Enumerable Domains . . . . . . . . . . 549Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 551

    37 Metatheory of Second-order Logic 55237.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55237.2 Second-order Arithmetic . . . . . . . . . . . . . . . . . . . . . . 55337.3 Second-order Logic is not Axiomatizable . . . . . . . . . . . . . 55437.4 Second-order Logic is not Compact . . . . . . . . . . . . . . . . 55537.5 The Löwenheim-Skolem Theorem Fails for Second-order Logic 555Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 556

    38 Second-order Logic and Set Theory 55738.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55738.2 Comparing Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . 55738.3 Cardinalities of Sets . . . . . . . . . . . . . . . . . . . . . . . . . 55838.4 The Power of the Continuum . . . . . . . . . . . . . . . . . . . . 559

    IX The Lambda Calculus 562

    39 Introduction 56439.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56439.2 The Syntax of the Lambda Calculus . . . . . . . . . . . . . . . . 56539.3 Reduction of Lambda Terms . . . . . . . . . . . . . . . . . . . . 56639.4 The Church-Rosser Property . . . . . . . . . . . . . . . . . . . . 56739.5 Currying . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56839.6 λ-Definable Arithmetical Functions . . . . . . . . . . . . . . . . 56939.7 λ-Definable Functions are Computable . . . . . . . . . . . . . . 56939.8 Computable Functions are λ-Definable . . . . . . . . . . . . . . 57039.9 The Basic Primitive Recursive Functions are λ-Definable . . . . 57039.10 The λ-Definable Functions are Closed under Composition . . . 57039.11 λ-Definable Functions are Closed under Primitive Recursion . 57139.12 Fixed-Point Combinators . . . . . . . . . . . . . . . . . . . . . . 57339.13 The λ-Definable Functions are Closed under Minimization . . 574

    40 Syntax 57640.1 Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576

    12 Release : 666b46f (2020-02-13)

  • CONTENTS

    40.2 Unique Readability . . . . . . . . . . . . . . . . . . . . . . . . . 57640.3 Abbreviated Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 57840.4 Free Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57840.5 Substitution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58040.6 α-Conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58240.7 The De Bruijn Index . . . . . . . . . . . . . . . . . . . . . . . . . 58640.8 Terms as α-Equivalence Classes . . . . . . . . . . . . . . . . . . 58740.9 β-reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58840.10 η-conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 590Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592

    41 The Church-Rosser Property 59341.1 Definition and Properties . . . . . . . . . . . . . . . . . . . . . . 59341.2 Parallel β-reduction . . . . . . . . . . . . . . . . . . . . . . . . . 59441.3 β-reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59641.4 Parallel βη-reduction . . . . . . . . . . . . . . . . . . . . . . . . 59841.5 βη-reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 599

    42 Lambda Definability 60042.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60042.2 λ-Definable Arithmetical Functions . . . . . . . . . . . . . . . . 60142.3 Pairs and Predecessor . . . . . . . . . . . . . . . . . . . . . . . . 60342.4 Truth Values and Relations . . . . . . . . . . . . . . . . . . . . . 60442.5 Primitive Recursive Functions are λ-Definable . . . . . . . . . . 60542.6 Fixpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60742.7 Minimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61042.8 Partial Recursive Functions are λ-Definable . . . . . . . . . . . 61142.9 λ-Definable Functions are Recursive . . . . . . . . . . . . . . . . 612Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 612

    X Normal Modal Logics 614

    43 Syntax and Semantics 61643.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61643.2 The Language of Basic Modal Logic . . . . . . . . . . . . . . . . 61743.3 Simultaneous Substitution . . . . . . . . . . . . . . . . . . . . . 61843.4 Relational Models . . . . . . . . . . . . . . . . . . . . . . . . . . 62043.5 Truth at a World . . . . . . . . . . . . . . . . . . . . . . . . . . . 62043.6 Truth in a Model . . . . . . . . . . . . . . . . . . . . . . . . . . . 62143.7 Validity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62243.8 Tautological Instances . . . . . . . . . . . . . . . . . . . . . . . . 62343.9 Schemas and Validity . . . . . . . . . . . . . . . . . . . . . . . . 625

    Release : 666b46f (2020-02-13) 13

  • CONTENTS

    43.10 Entailment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 626Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 627

    44 Frame Definability 63044.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63044.2 Properties of Accessibility Relations . . . . . . . . . . . . . . . . 63144.3 Frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63244.4 Frame Definability . . . . . . . . . . . . . . . . . . . . . . . . . . 63344.5 First-order Definability . . . . . . . . . . . . . . . . . . . . . . . 63544.6 Equivalence Relations and S5 . . . . . . . . . . . . . . . . . . . 63744.7 Second-order Definability . . . . . . . . . . . . . . . . . . . . . . 639Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641

    45 Axiomatic Derivations 64245.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64245.2 Normal Modal Logics . . . . . . . . . . . . . . . . . . . . . . . . 64345.3 Derivations and Modal Systems . . . . . . . . . . . . . . . . . . 64545.4 Proofs in K . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64645.5 Derived Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64845.6 More Proofs in K . . . . . . . . . . . . . . . . . . . . . . . . . . . 65045.7 Dual Formulas . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65145.8 Proofs in Modal Systems . . . . . . . . . . . . . . . . . . . . . . 65145.9 Soundness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65345.10 Showing Systems are Distinct . . . . . . . . . . . . . . . . . . . 65445.11 Derivability from a Set of Formulas . . . . . . . . . . . . . . . . 65545.12 Properties of Derivability . . . . . . . . . . . . . . . . . . . . . . 65645.13 Consistency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 656Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 657

    46 Completeness and Canonical Models 65846.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65846.2 Complete Σ-Consistent Sets . . . . . . . . . . . . . . . . . . . . 65946.3 Lindenbaum’s Lemma . . . . . . . . . . . . . . . . . . . . . . . . 66046.4 Modalities and Complete Consistent Sets . . . . . . . . . . . . . 66146.5 Canonical Models . . . . . . . . . . . . . . . . . . . . . . . . . . 66346.6 The Truth Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . 66446.7 Determination and Completeness for K . . . . . . . . . . . . . . 66446.8 Frame Completeness . . . . . . . . . . . . . . . . . . . . . . . . . 665Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668

    47 Filtrations and Decidability 66947.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66947.2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67147.3 Filtrations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 672

    14 Release : 666b46f (2020-02-13)

  • CONTENTS

    47.4 Examples of Filtrations . . . . . . . . . . . . . . . . . . . . . . . 67447.5 Filtrations are Finite . . . . . . . . . . . . . . . . . . . . . . . . . 67547.6 K and S5 have the Finite Model Property . . . . . . . . . . . . . 67647.7 S5 is Decidable . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67747.8 Filtrations and Properties of Accessibility . . . . . . . . . . . . . 67747.9 Filtrations of Euclidean Models . . . . . . . . . . . . . . . . . . 678Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 680

    48 Modal Tableaux 68248.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68248.2 Rules for K . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68348.3 Tableaux for K . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68548.4 Soundness for K . . . . . . . . . . . . . . . . . . . . . . . . . . . 68648.5 Rules for Other Accessibility Relations . . . . . . . . . . . . . . 68948.6 Soundness for Additional Rules . . . . . . . . . . . . . . . . . . 69048.7 Simple Tableaux for S5 . . . . . . . . . . . . . . . . . . . . . . . 69248.8 Completeness for K . . . . . . . . . . . . . . . . . . . . . . . . . 69348.9 Countermodels from Tableaux . . . . . . . . . . . . . . . . . . . 695Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 696

    XI Intuitionistic Logic 698

    49 Introduction 70049.1 Constructive Reasoning . . . . . . . . . . . . . . . . . . . . . . . 70049.2 Syntax of Intuitionistic Logic . . . . . . . . . . . . . . . . . . . . 70149.3 The Brouwer-Heyting-Kolmogorov Interpretation . . . . . . . . 70249.4 Natural Deduction . . . . . . . . . . . . . . . . . . . . . . . . . . 70549.5 Axiomatic Derivations . . . . . . . . . . . . . . . . . . . . . . . . 708Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 709

    50 Semantics 71050.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71050.2 Relational models . . . . . . . . . . . . . . . . . . . . . . . . . . 71150.3 Semantic Notions . . . . . . . . . . . . . . . . . . . . . . . . . . 71250.4 Topological Semantics . . . . . . . . . . . . . . . . . . . . . . . . 713Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 714

    51 Soundness and Completeness 71551.1 Soundness of Axiomatic Derivations . . . . . . . . . . . . . . . 71551.2 Soundness of Natural Deduction . . . . . . . . . . . . . . . . . . 71651.3 Lindenbaum’s Lemma . . . . . . . . . . . . . . . . . . . . . . . . 71751.4 The Canonical Model . . . . . . . . . . . . . . . . . . . . . . . . 71851.5 The Truth Lemma . . . . . . . . . . . . . . . . . . . . . . . . . . 719

    Release : 666b46f (2020-02-13) 15

  • CONTENTS

    51.6 The Completeness Theorem . . . . . . . . . . . . . . . . . . . . 720Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 720

    52 Propositions as Types 72152.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72152.2 Sequent Natural Deduction . . . . . . . . . . . . . . . . . . . . . 72352.3 Proof Terms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72452.4 Converting Derivations to Proof Terms . . . . . . . . . . . . . . 72552.5 Recovering Derivations from Proof Terms . . . . . . . . . . . . 72852.6 Reduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73052.7 Normalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . 732

    XII Counterfactuals 736

    53 Introduction 73753.1 The Material Conditional . . . . . . . . . . . . . . . . . . . . . . 73753.2 Paradoxes of the Material Conditional . . . . . . . . . . . . . . 73853.3 The Strict Conditional . . . . . . . . . . . . . . . . . . . . . . . . 73953.4 Counterfactuals . . . . . . . . . . . . . . . . . . . . . . . . . . . 741Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 742

    54 Minimal Change Semantics 74454.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74454.2 Sphere Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74554.3 Truth and Falsity of Counterfactuals . . . . . . . . . . . . . . . . 74754.4 Antecedent Strengthenng . . . . . . . . . . . . . . . . . . . . . . 74854.5 Transitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74954.6 Contraposition . . . . . . . . . . . . . . . . . . . . . . . . . . . . 750Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 751

    XIII Set Theory 753

    55 The Iterative Conception 75455.1 Extensionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75455.2 Russell’s Paradox (again) . . . . . . . . . . . . . . . . . . . . . . 75455.3 Predicative and Impredicative . . . . . . . . . . . . . . . . . . . 75555.4 The Cumulative-Iterative Approach . . . . . . . . . . . . . . . . 75755.5 Urelements or Not? . . . . . . . . . . . . . . . . . . . . . . . . . 75855.6 Frege’s Basic Law V . . . . . . . . . . . . . . . . . . . . . . . . . 760

    56 Steps towards Z 76156.1 The Story in More Detail . . . . . . . . . . . . . . . . . . . . . . 76156.2 Separation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 761

    16 Release : 666b46f (2020-02-13)

  • CONTENTS

    56.3 Union . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76356.4 Pairs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76356.5 Powersets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76456.6 Infinity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76556.7 Z−: a Milestone . . . . . . . . . . . . . . . . . . . . . . . . . . . 76756.8 Selecting our Natural Numbers . . . . . . . . . . . . . . . . . . 76756.9 Closure, Comprehension, and Intersection . . . . . . . . . . . . 768Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 769

    57 Ordinals 77057.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77057.2 The General Idea of an Ordinal . . . . . . . . . . . . . . . . . . . 77057.3 Well-Orderings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77157.4 Order-Isomorphisms . . . . . . . . . . . . . . . . . . . . . . . . . 77257.5 Von Neumann’s Construction . . . . . . . . . . . . . . . . . . . 77457.6 Basic Properties of the Ordinals . . . . . . . . . . . . . . . . . . 77557.7 Replacement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77757.8 ZF−: a milestone . . . . . . . . . . . . . . . . . . . . . . . . . . . 77857.9 Ordinals as Order-Types . . . . . . . . . . . . . . . . . . . . . . 77857.10 Successor and Limit Ordinals . . . . . . . . . . . . . . . . . . . . 780Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 781

    58 Stages and Ranks 78258.1 Defining the Stages as the Vαs . . . . . . . . . . . . . . . . . . . 78258.2 The Transfinite Recursion Theorem(s) . . . . . . . . . . . . . . . 78258.3 Basic Properties of Stages . . . . . . . . . . . . . . . . . . . . . . 78458.4 Foundation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78558.5 Z and ZF: A Milestone . . . . . . . . . . . . . . . . . . . . . . . 78758.6 Rank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 788

    59 Replacement 79059.1 The Strength of Replacement . . . . . . . . . . . . . . . . . . . . 79059.2 Extrinsic Considerations . . . . . . . . . . . . . . . . . . . . . . 79159.3 Limitation-of-size . . . . . . . . . . . . . . . . . . . . . . . . . . 79259.4 Replacement and “Absolute Infinity” . . . . . . . . . . . . . . . 79359.5 Replacement and Reflection . . . . . . . . . . . . . . . . . . . . 795Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 798

    60 Ordinal Arithmetic 79960.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79960.2 Ordinal Addition . . . . . . . . . . . . . . . . . . . . . . . . . . . 79960.3 Using Ordinal Addition . . . . . . . . . . . . . . . . . . . . . . . 80260.4 Ordinal Multiplication . . . . . . . . . . . . . . . . . . . . . . . . 80460.5 Ordinal Exponentiation . . . . . . . . . . . . . . . . . . . . . . . 805

    Release : 666b46f (2020-02-13) 17

  • CONTENTS

    Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 806

    61 Cardinals 80761.1 Cantor’s Principle . . . . . . . . . . . . . . . . . . . . . . . . . . 80761.2 Cardinals as Ordinals . . . . . . . . . . . . . . . . . . . . . . . . 80861.3 ZFC: A Milestone . . . . . . . . . . . . . . . . . . . . . . . . . . 80961.4 Finite, Enumerable, Non-enumerable . . . . . . . . . . . . . . . 81061.5 Hume’s Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . 812

    62 Cardinal Arithmetic 81562.1 Defining the Basic Operations . . . . . . . . . . . . . . . . . . . 81562.2 Simplifying Addition and Multiplication . . . . . . . . . . . . . 81762.3 Some Simplifications . . . . . . . . . . . . . . . . . . . . . . . . . 81862.4 The Continuum Hypothesis . . . . . . . . . . . . . . . . . . . . 81962.5 ℵ-Fixed Points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 821Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 824

    63 Choice 82563.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82563.2 The Tarski-Scott Trick . . . . . . . . . . . . . . . . . . . . . . . . 82563.3 Comparability and Hartogs’ Lemma . . . . . . . . . . . . . . . 82663.4 The Well-Ordering Problem . . . . . . . . . . . . . . . . . . . . . 82763.5 Countable Choice . . . . . . . . . . . . . . . . . . . . . . . . . . 82863.6 Intrinsic Considerations about Choice . . . . . . . . . . . . . . . 83163.7 The Banach-Tarski Paradox . . . . . . . . . . . . . . . . . . . . . 83263.8 Vitali’s Paradox . . . . . . . . . . . . . . . . . . . . . . . . . . . . 833Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 837

    XIV Methods 838

    64 Proofs 84064.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84064.2 Starting a Proof . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84164.3 Using Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . 84164.4 Inference Patterns . . . . . . . . . . . . . . . . . . . . . . . . . . 84364.5 An Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84964.6 Another Example . . . . . . . . . . . . . . . . . . . . . . . . . . 85264.7 Proof by Contradiction . . . . . . . . . . . . . . . . . . . . . . . 85364.8 Reading Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85764.9 I Can’t Do It! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85864.10 Other Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . 859Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 860

    65 Induction 861

    18 Release : 666b46f (2020-02-13)

  • CONTENTS

    65.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86165.2 Induction on N . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86265.3 Strong Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . 86465.4 Inductive Definitions . . . . . . . . . . . . . . . . . . . . . . . . 86565.5 Structural Induction . . . . . . . . . . . . . . . . . . . . . . . . . 86765.6 Relations and Functions . . . . . . . . . . . . . . . . . . . . . . . 868Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 871

    XV History 872

    66 Biographies 87366.1 Georg Cantor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87366.2 Alonzo Church . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87466.3 Gerhard Gentzen . . . . . . . . . . . . . . . . . . . . . . . . . . . 87566.4 Kurt Gödel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87666.5 Emmy Noether . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87766.6 Rózsa Péter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87866.7 Julia Robinson . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88066.8 Bertrand Russell . . . . . . . . . . . . . . . . . . . . . . . . . . . 88266.9 Alfred Tarski . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88366.10 Alan Turing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88466.11 Ernst Zermelo . . . . . . . . . . . . . . . . . . . . . . . . . . . . 885

    67 History and Mythology of Set Theory 88767.1 Infinitesimals and Differentiation . . . . . . . . . . . . . . . . . 88767.2 Rigorous Definition of Limits . . . . . . . . . . . . . . . . . . . . 88967.3 Pathologies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89067.4 More Myth than History? . . . . . . . . . . . . . . . . . . . . . . 89267.5 Cantor on the Line and the Plane . . . . . . . . . . . . . . . . . 89367.6 Hilbert’s Space-filling Curves . . . . . . . . . . . . . . . . . . . . 894

    Photo Credits 896

    Bibliography 898

    Release : 666b46f (2020-02-13) 19

  • CONTENTS

    This file loads all content included in the Open Logic Project. Editorialnotes like this, if displayed, indicate that the file was compiled withoutany thought to how this material will be presented. If you can read this,it is probably not advisable to teach or study from this PDF.

    The Open Logic Project provides many mechanisms by which a textcan be generate which is more appropriate for teaching or self-study. Forinstance, by default, the text will make all logical operators primitives andcarry out all cases for all operators in proofs. But it is much better to leavesome of these cases as exercises. The Open Logic Project is also a workin progress. In an effort to stimulate collaboration and improvemenent,material is included even if it is ony in draft form, is missing exercises,etc. A PDF produced for a course will exclude these sections.

    To find PDFs more suitable for teaching and studying, have a look atthe sample courses available on the OLP website. To make your own,you might start from the sample driver file or look at the sources of thederived textbooks for more fancy and advanced examples.

    20 Release : 666b46f (2020-02-13)

    http://builds.openlogicproject.org/https://github.com/OpenLogicProject/OpenLogic/tree/master/courses/sample

  • Part I

    Naı̈ve Set Theory

    21

  • CONTENTS

    The material in this part is an introduction to basic naive set theory.With the inclusion of Tim Button’s Open Set Theory, this also covers theconstruction of number systems, and discussion of infinity, which are notrequired for the logical parts of the OLP.

    22 Release : 666b46f (2020-02-13)

  • Chapter 1

    Sets

    1.1 Extensionality

    A set is a collection of objects, considered as a single object. The objects makingup the set are called elements or members of the set. If x is an element of a set a,we write x ∈ a; if not, we write x /∈ a. The set which has no elements is calledthe empty set and denoted “∅”.

    It does not matter how we specify the set, or how we order its elements, orindeed how many times we count its elements. All that matters are what itselements are. We codify this in the following principle.

    Definition 1.1 (Extensionality). If A and B are sets, then A = B iff every ele-ment of A is also an element of B, and vice versa.

    Extensionality licenses some notation. In general, when we have someobjects a1, . . . , an, then {a1, . . . , an} is the set whose elements are a1, . . . , an. Weemphasise the word “the”, since extensionality tells us that there can be onlyone such set. Indeed, extensionality also licenses the following:

    {a, a, b} = {a, b} = {b, a}.

    This delivers on the point that, when we consider sets, we don’t care aboutthe order of their elements, or how many times they are specified.

    Example 1.2. Whenever you have a bunch of objects, you can collect themtogether in a set. The set of Richard’s siblings, for instance, is a set that con-tains one person, and we could write it as S = {Ruth}. The set of positiveintegers less than 4 is {1, 2, 3}, but it can also be written as {3, 2, 1} or even as{1, 2, 1, 2, 3}. These are all the same set, by extensionality. For every elementof {1, 2, 3} is also an element of {3, 2, 1} (and of {1, 2, 1, 2, 3}), and vice versa.

    Frequently we’ll specify a set by some property that its elements share.We’ll use the following shorthand notation for that: {x : ϕ(x)}, where the

    23

  • CHAPTER 1. SETS

    ϕ(x) stands for the property that x has to have in order to be counted amongthe elements of the set.

    Example 1.3. In our example, we could have specified S also as

    S = {x : x is a sibling of Richard}.

    Example 1.4. A number is called perfect iff it is equal to the sum of its properdivisors (i.e., numbers that evenly divide it but aren’t identical to the number).For instance, 6 is perfect because its proper divisors are 1, 2, and 3, and 6 =1 + 2 + 3. In fact, 6 is the only positive integer less than 10 that is perfect. So,using extensionality, we can say:

    {6} = {x : x is perfect and 0 ≤ x ≤ 10}

    We read the notation on the right as “the set of x’s such that x is perfect and0 ≤ x ≤ 10”. The identity here confirms that, when we consider sets, we don’tcare about how they are specified. And, more generally, extensionality guar-antees that there is always only one set of x’s such that ϕ(x). So, extensionalityjustifies calling {x : ϕ(x)} the set of x’s such that ϕ(x).

    Extensionality gives us a way for showing that sets are identical: to showthat A = B, show that whenever x ∈ A then also x ∈ B, and whenever y ∈ Bthen also y ∈ A.

    1.2 Subsets and Power Sets

    We will often want to compare sets. And one obvious kind of comparison onemight make is as follows: everything in one set is in the other too. This situationis sufficiently important for us to introduce some new notation.

    Definition 1.5 (Subset). If every element of a set A is also an element of B,then we say that A is a subset of B, and write A ⊆ B. If A is not a subset of Bwe write A 6⊆ B. If A ⊆ B but A 6= B, we write A ( B and say that A is aproper subset of B.

    Example 1.6. Every set is a subset of itself, and ∅ is a subset of every set. Theset of even numbers is a subset of the set of natural numbers. Also, {a, b} ⊆{a, b, c}. But {a, b, e} is not a subset of {a, b, c}.

    Example 1.7. The number 2 is an element of the set of integers, whereas theset of even numbers is a subset of the set of integers. However, a set may hap-pen to both be an element and a subset of some other set, e.g., {0} ∈ {0, {0}}and also {0} ⊆ {0, {0}}.

    24 Release : 666b46f (2020-02-13)

  • 1.2. SUBSETS AND POWER SETS

    Extensionality gives a criterion of identity for sets: A = B iff every elementof A is also an element of B and vice versa. The definition of “subset” definesA ⊆ B precisely as the first half of this criterion: every element of A is alsoan element of B. Of course the definition also applies if we switch A and B:that is, B ⊆ A iff every element of B is also an element of A. And that, in turn,is exactly the “vice versa” part of extensionality. In other words, extensionalityentails that sets are equal iff they are subsets of one another.

    Proposition 1.8. A = B iff both A ⊆ B and B ⊆ A.

    Now is also a good opportunity to introduce some further bits of helpfulnotation. In defining when A is a subset of B we said that “every element of Ais . . . ,” and filled the “. . . ” with “an element of B”. But this is such a commonshape of expression that it will be helpful to introduce some formal notationfor it.

    Definition 1.9. (∀x ∈ A)ϕ abbreviates ∀x(x ∈ A→ ϕ). Similarly, (∃x ∈ A)ϕabbreviates ∃x(x ∈ A ∧ ϕ).

    Using this notation, we can say that A ⊆ B iff (∀x ∈ A)x ∈ B.Now we move on to considering a certain kind of set: the set of all subsets

    of a given set.

    Definition 1.10 (Power Set). The set consisting of all subsets of a set A is calledthe power set of A, written ℘(A).

    ℘(A) = {B : B ⊆ A}

    Example 1.11. What are all the possible subsets of {a, b, c}? They are: ∅,{a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}. The set of all these subsets is℘({a, b, c}):

    ℘({a, b, c}) = {∅, {a}, {b}, {c}, {a, b}, {b, c}, {a, c}, {a, b, c}}

    Release : 666b46f (2020-02-13) 25

  • CHAPTER 1. SETS

    1.3 Some Important Sets

    Example 1.12. We will mostly be dealing with sets whose elements are math-ematical objects. Four such sets are important enough to have specific names:

    N = {0, 1, 2, 3, . . .}the set of natural numbers

    Z = {. . . ,−2,−1, 0, 1, 2, . . .}the set of integers

    Q = {m/n : m, n ∈ Z and n 6= 0}the set of rationals

    R = (−∞, ∞)the set of real numbers (the continuum)

    These are all infinite sets, that is, they each have infinitely many elements.As we move through these sets, we are adding more numbers to our stock.

    Indeed, it should be clear that N ⊆ Z ⊆ Q ⊆ R: after all, every naturalnumber is an integer; every integer is a rational; and every rational is a real.Equally, it should be clear that N ( Z ( Q, since −1 is an integer but nota natural number, and 1/2 is rational but not integer. It is less obvious thatQ ( R, i.e., that there are some real numbers which are not rational.

    We’ll sometimes also use the set of positive integers Z+ = {1, 2, 3, . . . } andthe set containing just the first two natural numbers B = {0, 1}.

    Example 1.13 (Strings). Another interesting example is the set A∗ of finitestrings over an alphabet A: any finite sequence of elements of A is a stringover A. We include the empty string Λ among the strings over A, for everyalphabet A. For instance,

    B∗ = {Λ, 0, 1, 00, 01, 10, 11,000, 001, 010, 011, 100, 101, 110, 111, 0000, . . .}.

    If x = x1 . . . xn ∈ A∗is a string consisting of n “letters” from A, then we saylength of the string is n and write len(x) = n.

    Example 1.14 (Infinite sequences). For any set A we may also consider theset Aω of infinite sequences of elements of A. An infinite sequence a1a2a3a4 . . .consists of a one-way infinite list of objects, each one of which is an elementof A.

    1.4 Unions and Intersections

    In section 1.1, we introduced definitions of sets by abstraction, i.e., definitionsof the form {x : ϕ(x)}. Here, we invoke some property ϕ, and this property

    26 Release : 666b46f (2020-02-13)

  • 1.4. UNIONS AND INTERSECTIONS

    Figure 1.1: The union A ∪ B of two sets is set of elements of A together withthose of B.

    can mention sets we’ve already defined. So for instance, if A and B are sets,the set {x : x ∈ A ∨ x ∈ B} consists of all those objects which are elementsof either A or B, i.e., it’s the set that combines the elements of A and B. Wecan visualize this as in Figure 1.1, where the highlighted area indicates theelements of the two sets A and B together.

    This operation on sets—combining them—is very useful and common,and so we give it a formal name and a symbol.

    Definition 1.15 (Union). The union of two sets A and B, written A ∪ B, is theset of all things which are elements of A, B, or both.

    A ∪ B = {x : x ∈ A ∨ x ∈ B}

    Example 1.16. Since the multiplicity of elements doesn’t matter, the union oftwo sets which have an element in common contains that element only once,e.g., {a, b, c} ∪ {a, 0, 1} = {a, b, c, 0, 1}.

    The union of a set and one of its subsets is just the bigger set: {a, b, c} ∪{a} = {a, b, c}.

    The union of a set with the empty set is identical to the set: {a, b, c} ∪∅ ={a, b, c}.

    We can also consider a “dual” operation to union. This is the operationthat forms the set of all elements that are elements of A and are also elementsof B. This operation is called intersection, and can be depicted as in Figure 1.2.

    Definition 1.17 (Intersection). The intersection of two sets A and B, writtenA ∩ B, is the set of all things which are elements of both A and B.

    A ∩ B = {x : x ∈ A ∧ x ∈ B}

    Two sets are called disjoint if their intersection is empty. This means they haveno elements in common.

    Release : 666b46f (2020-02-13) 27

  • CHAPTER 1. SETS

    Figure 1.2: The intersection A ∩ B of two sets is the set of elements they havein common.

    Example 1.18. If two sets have no elements in common, their intersection isempty: {a, b, c} ∩ {0, 1} = ∅.

    If two sets do have elements in common, their intersection is the set of allthose: {a, b, c} ∩ {a, b, d} = {a, b}.

    The intersection of a set with one of its subsets is just the smaller set:{a, b, c} ∩ {a, b} = {a, b}.

    The intersection of any set with the empty set is empty: {a, b, c} ∩∅ = ∅.

    We can also form the union or intersection of more than two sets. Anelegant way of dealing with this in general is the following: suppose youcollect all the sets you want to form the union (or intersection) of into a singleset. Then we can define the union of all our original sets as the set of all objectswhich belong to at least one element of the set, and the intersection as the setof all objects which belong to every element of the set.

    Definition 1.19. If A is a set of sets, then⋃

    A is the set of elements of elementsof A: ⋃

    A = {x : x belongs to an element of A}, i.e.,= {x : there is a B ∈ A so that x ∈ B}

    Definition 1.20. If A is a set of sets, then⋂

    A is the set of objects which allelements of A have in common:⋂

    A = {x : x belongs to every element of A}, i.e.,= {x : for all B ∈ A, x ∈ B}

    Example 1.21. Suppose A = {{a, b}, {a, d, e}, {a, d}}. Then ⋃ A = {a, b, d, e}and

    ⋂A = {a}.

    28 Release : 666b46f (2020-02-13)

  • 1.5. PAIRS, TUPLES, CARTESIAN PRODUCTS

    Figure 1.3: The difference A \ B of two sets is the set of those elements of Awhich are not also elements of B.

    We could also do the same for a sequence of sets A1, A2, . . .⋃i

    Ai = {x : x belongs to one of the Ai}⋂i

    Ai = {x : x belongs to every Ai}.

    When we have an index of sets, i.e., some set I such that we are consideringAi for each i ∈ I, we may also use these abbreviations:⋃

    i∈IAi =

    ⋃{Ai : i ∈ I}⋂

    i∈IAi =

    ⋂{Ai : i ∈ I}

    Finally, we may want to think about the set of all elements in A which arenot in B. We can depict this as in Figure 1.3.

    Definition 1.22 (Difference). The set difference A \ B is the set of all elementsof A which are not also elements of B, i.e.,

    A \ B = {x : x ∈ A and x /∈ B}.

    1.5 Pairs, Tuples, Cartesian Products

    It follows from extensionality that sets have no order to their elements. So ifwe want to represent order, we use ordered pairs 〈x, y〉. In an unordered pair{x, y}, the order does not matter: {x, y} = {y, x}. In an ordered pair, it does:if x 6= y, then 〈x, y〉 6= 〈y, x〉.

    How should we think about ordered pairs in set theory? Crucially, wewant to preserve the idea that ordered pairs are identical iff they share thesame first element and share the same second element, i.e.:

    〈a, b〉 = 〈c, d〉 iff both a = c and b = d.

    Release : 666b46f (2020-02-13) 29

  • CHAPTER 1. SETS

    We can define ordered pairs in set theory using the Wiener-Kuratowski defi-nition.

    Definition 1.23 (Ordered pair). 〈a, b〉 = {{a}, {a, b}}.

    Having fixed a definition of an ordered pair, we can use it to define fur-ther sets. For example, sometimes we also want ordered sequences of morethan two objects, e.g., triples 〈x, y, z〉, quadruples 〈x, y, z, u〉, and so on. We canthink of triples as special ordered pairs, where the first element is itself an or-dered pair: 〈x, y, z〉 is 〈〈x, y〉, z〉. The same is true for quadruples: 〈x, y, z, u〉 is〈〈〈x, y〉, z〉, u〉, and so on. In general, we talk of ordered n-tuples 〈x1, . . . , xn〉.

    Certain sets of ordered pairs, or other ordered n-tuples, will be useful.

    Definition 1.24 (Cartesian product). Given sets A and B, their Cartesian prod-uct A× B is defined by

    A× B = {〈x, y〉 : x ∈ A and y ∈ B}.

    Example 1.25. If A = {0, 1}, and B = {1, a, b}, then their product is

    A× B = {〈0, 1〉, 〈0, a〉, 〈0, b〉, 〈1, 1〉, 〈1, a〉, 〈1, b〉}.

    Example 1.26. If A is a set, the product of A with itself, A × A, is also writ-ten A2. It is the set of all pairs 〈x, y〉with x, y ∈ A. The set of all triples 〈x, y, z〉is A3, and so on. We can give a recursive definition:

    A1 = A

    Ak+1 = Ak × A

    Proposition 1.27. If A has n elements and B has m elements, then A× B has n ·melements.

    Proof. For every element x in A, there are m elements of the form 〈x, y〉 ∈A× B. Let Bx = {〈x, y〉 : y ∈ B}. Since whenever x1 6= x2, 〈x1, y〉 6= 〈x2, y〉,Bx1 ∩ Bx2 = ∅. But if A = {x1, . . . , xn}, then A× B = Bx1 ∪ · · · ∪ Bxn , and sohas n ·m elements.

    To visualize this, arrange the elements of A× B in a grid:

    Bx1 = {〈x1, y1〉 〈x1, y2〉 . . . 〈x1, ym〉}Bx2 = {〈x2, y1〉 〈x2, y2〉 . . . 〈x2, ym〉}

    ......

    Bxn = {〈xn, y1〉 〈xn, y2〉 . . . 〈xn, ym〉}

    Since the xi are all different, and the yj are all different, no two of the pairs inthis grid are the same, and there are n ·m of them.

    30 Release : 666b46f (2020-02-13)

  • 1.6. RUSSELL’S PARADOX

    Example 1.28. If A is a set, a word over A is any sequence of elements of A. Asequence can be thought of as an n-tuple of elements of A. For instance, if A ={a, b, c}, then the sequence “bac” can be thought of as the triple 〈b, a, c〉. Words,i.e., sequences of symbols, are of crucial importance in computer science. Byconvention, we count elements of A as sequences of length 1, and ∅ as thesequence of length 0. The set of all words over A then is

    A∗ = {∅} ∪ A ∪ A2 ∪ A3 ∪ . . .

    1.6 Russell’s Paradox

    Extensionality licenses the notation {x : ϕ(x)}, for the set of x’s such that ϕ(x).However, all that extensionality really licenses is the following thought. Ifthere is a set whose members are all and only the ϕ’s, then there is only onesuch set. Otherwise put: having fixed some ϕ, the set {x : ϕ(x)} is unique, ifit exists.

    But this conditional is important! Crucially, not every property lends itselfto comprehension. That is, some properties do not define sets. If they all did,then we would run into outright contradictions. The most famous example ofthis is Russell’s Paradox.

    Sets may be elements of other sets—for instance, the power set of a set Ais made up of sets. And so it makes sense to ask or investigate whether a setis an element of another set. Can a set be a member of itself? Nothing aboutthe idea of a set seems to rule this out. For instance, if all sets form a collectionof objects, one might think that they can be collected into a single set—the setof all sets. And it, being a set, would be an element of the set of all sets.

    Russell’s Paradox arises when we consider the property of not having itselfas an element, of being non-self-membered. What if we suppose that there is aset of all sets that do not have themselves as an element? Does

    R = {x : x /∈ x}

    exist? It turns out that we can prove that it does not.

    Theorem 1.29 (Russell’s Paradox). There is no set R = {x : x /∈ x}.

    Proof. For reductio, suppose that R = {x : x /∈ x} exists. Then R ∈ R iffR /∈ R, since sets are extensional. But this is a contradicion.

    Let’s run through the proof that no set R of non-self-membered sets canexist more slowly. If R exists, it makes sense to ask if R ∈ R or not—it must beeither ∈ R or /∈ R. Suppose the former is true, i.e., R ∈ R. R was defined as theset of all sets that are not elements of themselves, and so if R ∈ R, then R doesnot have this defining property of R. But only sets that have this property are

    Release : 666b46f (2020-02-13) 31

  • CHAPTER 1. SETS

    in R, hence, R cannot be an element of R, i.e., R /∈ R. But R can’t both be andnot be an element of R, so we have a contradiction.

    Since the assumption that R ∈ R leads to a contradiction, we have R /∈ R.But this also leads to a contradiction! For if R /∈ R, it does have the definingproperty of R, and so would be an element of R just like all the other non-self-membered sets. And again, it can’t both not be and be an element of R.

    How do we set up a set theory which avoids falling into Russell’s Para-dox, i.e., which avoids making the inconsistent claim that R = {x : x /∈ x}exists? Well, we would need to lay down axioms which give us very preciseconditions for stating when sets exist (and when they don’t).

    The set theory sketched in this chapter doesn’t do this. It’s genuinely naı̈ve.It tells you only that sets obey extensionality and that, if you have some sets,you can form their union, intersection, etc. It is possible to develop set theorymore rigorously than this.

    Problems

    Problem 1.1. Prove that there is at most one empty set, i.e., show that if A andB are sets without elements, then A = B.

    Problem 1.2. List all subsets of {a, b, c, d}.

    Problem 1.3. Show that if A has n elements, then ℘(A) has 2n elements.

    Problem 1.4. Prove that if A ⊆ B, then A ∪ B = B.

    Problem 1.5. Prove rigorously that if A ⊆ B, then A ∩ B = A.

    Problem 1.6. Show that if A is a set and A ∈ B, then A ⊆ ⋃ B.Problem 1.7. Prove that if A ( B, then B \ A 6= ∅.

    Problem 1.8. Using Definition 1.23, prove that 〈a, b〉 = 〈c, d〉 iff both a = cand b = d.

    Problem 1.9. List all elements of {1, 2, 3}3.

    Problem 1.10. Show, by induction on k, that for all k ≥ 1, if A has n elements,then Ak has nk elements.

    32 Release : 666b46f (2020-02-13)

  • Chapter 2

    Relations

    2.1 Relations as Sets

    In section 1.3, we mentioned some important sets: N, Z, Q, R. You will nodoubt remember some interesting relations between the elements of some ofthese sets. For instance, each of these sets has a completely standard orderrelation on it. There is also the relation is identical with that every object bearsto itself and to no other thing. There are many more interesting relations thatwe’ll encounter, and even more possible relations. Before we review them,though, we will start by pointing out that we can look at relations as a specialsort of set.

    For this, recall two things from section 1.5. First, recall the notion of a or-dered pair: given a and b, we can form 〈a, b〉. Importantly, the order of elementsdoes matter here. So if a 6= b then 〈a, b〉 6= 〈b, a〉. (Contrast this with unorderedpairs, i.e., 2-element sets, where {a, b} = {b, a}.) Second, recall the notion ofa Cartesian product: if A and B are sets, then we can form A× B, the set of allpairs 〈x, y〉 with x ∈ A and y ∈ B. In particular, A2 = A× A is the set of allordered pairs from A.

    Now we will consider a particular relation on a set: the

  • CHAPTER 2. RELATIONS

    corresponding relation between numbers, namely, the relationship n bears tom if and only if 〈n, m〉 ∈ S. This justifies the following definition:

    Definition 2.1 (Binary relation). A binary relation on a set A is a subset of A2.If R ⊆ A2 is a binary relation on A and x, y ∈ A, we sometimes write Rxy (orxRy) for 〈x, y〉 ∈ R.

    Example 2.2. The set N2 of pairs of natural numbers can be listed in a 2-dimensional matrix like this:

    〈0, 0〉 〈0, 1〉 〈0, 2〉 〈0, 3〉 . . .〈1, 0〉 〈1, 1〉 〈1, 2〉 〈1, 3〉 . . .〈2, 0〉 〈2, 1〉 〈2, 2〉 〈2, 3〉 . . .〈3, 0〉 〈3, 1〉 〈3, 2〉 〈3, 3〉 . . .

    ......

    ......

    . . .

    We have put the diagonal, here, in bold, since the subset of N2 consisting ofthe pairs lying on the diagonal, i.e.,

    {〈0, 0〉, 〈1, 1〉, 〈2, 2〉, . . . },

    is the identity relation on N. (Since the identity relation is popular, let’s defineIdA = {〈x, x〉 : x ∈ X} for any set A.) The subset of all pairs lying above thediagonal, i.e.,

    L = {〈0, 1〉, 〈0, 2〉, . . . , 〈1, 2〉, 〈1, 3〉, . . . , 〈2, 3〉, 〈2, 4〉, . . .},

    is the less than relation, i.e., Lnm iff n < m. The subset of pairs below thediagonal, i.e.,

    G = {〈1, 0〉, 〈2, 0〉, 〈2, 1〉, 〈3, 0〉, 〈3, 1〉, 〈3, 2〉, . . . },

    is the greater than relation, i.e., Gnm iff n > m. The union of L with I, whichwe might call K = L ∪ I, is the less than or equal to relation: Knm iff n ≤ m.Similarly, H = G ∪ I is the greater than or equal to relation. These relations L, G,K, and H are special kinds of relations called orders. L and G have the propertythat no number bears L or G to itself (i.e., for all n, neither Lnn nor Gnn).Relations with this property are called irreflexive, and, if they also happen tobe orders, they are called strict orders.

    Although orders and identity are important and natural relations, it shouldbe emphasized that according to our definition any subset of A2 is a relationon A, regardless of how unnatural or contrived it seems. In particular, ∅ is arelation on any set (the empty relation, which no pair of elements bears), andA2 itself is a relation on A as well (one which every pair bears), called theuniversal relation. But also something like E = {〈n, m〉 : n > 5 or m× n ≥ 34}counts as a relation.

    34 Release : 666b46f (2020-02-13)

  • 2.2. PHILOSOPHICAL REFLECTIONS

    2.2 Philosophical Reflections

    In section 2.1, we defined relations as certain sets. We should pause and ask aquick philosophical question: what is such a definition doing? It is extremelydoubtful that we should want to say that we have discovered some metaphys-ical identity facts; that, for example, the order relation on N turned out to bethe set R = {〈n, m〉 : n, m ∈ N and n < m} we defined in section 2.1. Hereare three reasons why.

    First: in Definition 1.23, we defined 〈a, b〉 = {{a}, {a, b}}. Consider in-stead the definition ‖a, b‖ = {{b}, {a, b}} = 〈b, a〉. When a 6= b, we have that〈a, b〉 6= ‖a, b‖. But we could equally have regarded ‖a, b‖ as our definitionof an ordered pair, rather than 〈a, b〉. Both definitions would have workedequally well. So now we have two equally good candidates to “be” the orderrelation on the natural numbers, namely:

    R = {〈n, m〉 : n, m ∈N and n < m}S = {‖n, m‖ : n, m ∈N and n < m}.

    Since R 6= S, by extensionality, it is clear that they cannot both be identical tothe order relation on N. But it would just be arbitrary, and hence a bit embar-rassing, to claim that R rather than S (or vice versa) is the ordering relation,as a matter of fact. (This is a very simple instance of an argument against set-theoretic reductionism which Benacerraf made famous in 1965. We will revisitit several times.)

    Second: if we think that every relation should be identified with a set, thenthe relation of set-membership itself, ∈, should be a particular set. Indeed,it would have to be the set {〈x, y〉 : x ∈ y}. But does this set exist? GivenRussell’s Paradox, it is a non-trivial claim that such a set exists. In fact, it ispossible to develop set theory in a rigorous way as an axiomatic theory. Inthis theory, it will be provable that there is no set of all sets. So, even if somerelations can be treated as sets, the relation of set-membership will have to bea special case.

    Third: when we “identify” relations with sets, we said that we would al-low ourselves to write Rxy for 〈x, y〉 ∈ R. This is fine, provided that themembership relation, “∈”, is treated as a predicate. But if we think that “∈”stands for a certain kind of set, then the expression “〈x, y〉 ∈ R” just consistsof three singular terms which stand for sets: “〈x, y〉”, “∈”, and “R”. And sucha list of names is no more capable of expressing a proposition than the non-sense string: “the cup penholder the table”. Again, even if some relations canbe treated as sets, the relation of set-membership must be a special case. (Thisrolls together a simple version of Frege’s concept horse paradox, and a famousobjection that Wittgenstein once raised against Russell.)

    So where does this leave us? Well, there is nothing wrong with our sayingthat the relations on the numbers are sets. We just have to understand the

    Release : 666b46f (2020-02-13) 35

  • CHAPTER 2. RELATIONS

    spirit in which that remark is made. We are not stating a metaphysical identityfact. We are simply noting that, in certain contexts, we can (and will) treat(certain) relations as certain sets.

    2.3 Special Properties of Relations

    Some kinds of relations turn out to be so common that they have been givenspecial names. For instance, ≤ and ⊆ both relate their respective domains(say, N in the case of ≤ and ℘(A) in the case of ⊆) in similar ways. To getat exactly how these relations are similar, and how they differ, we categorizethem according to some special properties that relations can have. It turns outthat (combinations of) some of these special properties are especially impor-tant: orders and equivalence relations.

    Definition 2.3 (Reflexivity). A relation R ⊆ A2 is reflexive iff, for every x ∈ A,Rxx.

    Definition 2.4 (Transitivity). A relation R ⊆ A2 is transitive iff, whenever Rxyand Ryz, then also Rxz.

    Definition 2.5 (Symmetry). A relation R ⊆ A2 is symmetric iff, whenever Rxy,then also Ryx.

    Definition 2.6 (Anti-symmetry). A relation R ⊆ A2 is anti-symmetric iff, when-ever both Rxy and Ryx, then x = y (or, in other words: if x 6= y then either¬Rxy or ¬Ryx).

    In a symmetric relation, Rxy and Ryx always hold together, or neitherholds. In an anti-symmetric relation, the only way for Rxy and Ryx to hold to-gether is if x = y. Note that this does not require that Rxy and Ryx holds whenx = y, only that it isn’t ruled out. So an anti-symmetric relation can be reflex-ive, but it is not the case that every anti-symmetric relation is reflexive. Alsonote that being anti-symmetric and merely not being symmetric are differentconditions. In fact, a relation can be both symmetric and anti-symmetric at thesame time (e.g., the identity relation is).

    Definition 2.7 (Connectivity). A relation R ⊆ A2 is connected if for all x, y ∈X, if x 6= y, then either Rxy or Ryx.

    Definition 2.8 (Irreflexivity). A relation R ⊆ A2 is called irreflexive if, for allx ∈ A, not Rxx.

    Definition 2.9 (Asymmetry). A relation R ⊆ A2 is called asymmetric if for nopair x, y ∈ A we have both Rxy and Ryx.

    36 Release : 666b46f (2020-02-13)

  • 2.4. EQUIVALENCE RELATIONS

    Note that if A 6= ∅, then no irreflexive relation on A is reflexive and everyasymmetric relation on A is also anti-symmetric. However, there are R ⊆ A2that are not reflexive and also not irreflexive, and there are anti-symmetricrelations that are not asymmetric.

    2.4 Equivalence Relations

    The identity relation on a set is reflexive, symmetric, and transitive. Rela-tions R that have all three of these properties are very common.

    Definition 2.10 (Equivalence relation). A relation R ⊆ A2 that is reflexive,symmetric, and transitive is called an equivalence relation. Elements x and yof A are said to be R-equivalent if Rxy.

    Equivalence relations give rise to the notion of an equivalence class. Anequivalence relation “chunks up” the domain into different partitions. Withineach partition, all the objects are related to one another; and no objects fromdifferent partitions relate to one another. Sometimes, it’s helpful just to talkabout these partitions directly. To that end, we introduce a definition:

    Definition 2.11. Let R ⊆ A2 be an equivalence relation. For each x ∈ A, theequivalence class of x in A is the set [x]R = {y ∈ A : Rxy}. The quotient of Aunder R is A/R = {[x]R : x ∈ A}, i.e., the set of these equivalence classes.

    The next result vindicates the definition of an equivalence class, in provingthat the equivalence classes are indeed the partitions of A:

    Proposition 2.12. If R ⊆ A2 is an equivalence relation, then Rxy iff [x]R = [y]R.

    Proof. For the left-to-right direction, suppose Rxy, and let z ∈ [x]R. By defi-nition, then, Rxz. Since R is an equivalence relation, Ryz. (Spelling this out:as Rxy and R is symmetric we have Ryx, and as Rxz and R is transitive wehave Ryz.) So z ∈ [y]R. Generalising, [x]R ⊆ [y]R. But exactly similarly,[y]R ⊆ [x]R. So [x]R = [y]R, by extensionality.

    For the right-to-left direction, suppose [x]R = [y]R. Since R is reflexive,Ryy, so y ∈ [y]R. Thus also y ∈ [x]R by the assumption that [x]R = [y]R. SoRxy.

    Example 2.13. A nice example of equivalence relations comes from modulararithmetic. For any a, b, and n ∈ N, say that a ≡n b iff dividing a by n givesremainder b. (Somewhat more symbolically: a ≡n b iff (∃k ∈ N)a− b = kn.)Now, ≡n is an equivalence relation, for any n. And there are exactly n distinctequivalence classes generated by ≡n; that is, N/≡n has n elements. Theseare: the set of numbers divisible by n without remainder, i.e., [0]≡n ; the set ofnumbers divisible by n with remainder 1, i.e., [1]≡n ; . . . ; and the set of numbersdivisible by n with remainder n− 1, i.e., [n− 1]≡n .

    Release : 666b46f (2020-02-13) 37

  • CHAPTER 2. RELATIONS

    2.5 Orders

    Many of our comparisons involve describing some objects as being “less than”,“equal to”, or “greater than” other objects, in a certain respect. These involveorder relations. But there are different kinds of order relations. For instance,some require that any two objects be comparable, others don’t. Some includeidentity (like ≤) and some exclude it (like

  • 2.5. ORDERS

    Definition 2.22 (Strict linear order). A strict order which is also connected iscalled a strict linear order.

    Example 2.23. ≤ is the linear order corresponding to the strict linear order

  • CHAPTER 2. RELATIONS

    Proposition 2.28. If < totally orders A, then:

    (∀a, b ∈ A)((∀x ∈ A)(x < a↔ x < b)→ a = b)

    Proof. Suppose (∀x ∈ A)(x < a↔ x < b). If a < b, then a < a, contradictingthe fact that < is irreflexive; so a ≮ b. Exactly similarly, b ≮ a. So a = b, as <is connected.

    2.6 Graphs

    A graph is a diagram in which points—called “nodes” or “vertices” (plural of“vertex”)—are connected by edges. Graphs are a ubiquitous tool in discretemathematics and in computer science. They are incredibly useful for repre-senting, and visualizing, relationships and structures, from concrete thingslike networks of various kinds to abstract structures such as the possible out-comes of decisions. There are many different kinds of graphs in the literaturewhich differ, e.g., according to whether the edges are directed or not, have la-bels or not, whether there can be edges from a node to the same node, multipleedges between the same nodes, etc. Directed graphs have a special connectionto relations.

    Definition 2.29 (Directed graph). A directed graph G = 〈V, E〉 is a set of ver-tices V and a set of edges E ⊆ V2.

    According to our definition, a graph just is a set together with a relationon that set. Of course, when talking about graphs, it’s only natural to expectthat they are graphically represented: we can draw a graph by connecting twovertices v1 and v2 by an arrow iff 〈v1, v2〉 ∈ E. The only difference between arelation by itself and a graph is that a graph specifies the set of vertices, i.e., agraph may have isolated vertices. The important point, however, is that everyrelation R on a set X can be seen as a directed graph 〈X, R〉, and conversely, adirected graph 〈V, E〉 can be seen as a relation E ⊆ V2 with the set V explicitlyspecified.

    Example 2.30. The graph 〈V, E〉 with V = {1, 2, 3, 4} and E = {〈1, 1〉, 〈1, 2〉,〈1, 3〉, 〈2, 3〉} looks like this:

    1 2

    3

    4

    40 Release : 666b46f (2020-02-13)

  • 2.7. OPERATIONS ON RELATIONS

    This is a different graph than 〈V′, E〉with V′ = {1, 2, 3}, which looks like this:

    1 2

    3

    2.7 Operations on Relations

    It is often useful to modify or combine relations. In Proposition 2.25, we con-sidered the union of relations, which is just the union of two relations consid-ered as sets of pairs. Similarly, in Proposition 2.26, we considered the relativedifference of relations. Here are some other operations we can perform onrelations.

    Definition 2.31. Let R, S be relations, and A be any set.The inverse of R is R−1 = {〈y, x〉 : 〈x, y〉 ∈ R}.The relative product of R and S is (R | S) = {〈x, z〉 : ∃y(Rxy ∧ Syz)}.The restriction of R to A is R�A = R ∩ A2.The application of R to A is R[A] = {y : (∃x ∈ A)Rxy}

    Example 2.32. Let S ⊆ Z2 be the successor relation on Z, i.e., S = {〈x, y〉 ∈Z2 : x + 1 = y}, so that Sxy iff x + 1 = y.

    S−1 is the predecessor relation on Z, i.e., {〈x, y〉 ∈ Z2 : x− 1 = y}.S | S is {〈x, y〉 ∈ Z2 : x + 2 = y}S�N is the successor relation on N.S[{1, 2, 3}] is {2, 3, 4}.

    Definition 2.33 (Transitive closure). Let R ⊆ A2 be a binary relation.The transitive closure of R is R+ =

    ⋃0 1. In other words, S+xy iffx < y, and S∗xy iff x ≤ y.

    Problems

    Problem 2.1. List the elements of the relation ⊆ on the set ℘({a, b, c}).

    Release : 666b46f (2020-02-13) 41

  • CHAPTER 2. RELATIONS

    Problem 2.2. Give examples of relations that are (a) reflexive and symmetricbut not transitive, (b) reflexive and anti-symmetric, (c) anti-symmetric, transi-tive, but not reflexive, and (d) reflexive, symmetric, and transitive. Do not user