Analysis I, Section 3.1 #
In this section we set up a version of Zermelo-Frankel set theory (with atoms) that tries to be as faithful as possible to the original text of Analysis I, Section 3.1. All numbering refers to the original text.
I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.
Main constructions and results of this section:
- A type
Chapter3.Setof sets - A type
Chapter3.Objectof objects - An axiom that every set is (or can be coerced into) an object
- The empty set
∅, singletons{y}, and pairs{y,z}(and more general finite tuples), with their attendant axioms - Pairwise union
X ∪ Y, and their attendant axioms - Coercion of a set
Ato its associated typeA.toSubtype, which is a subtype ofObject, and basic API. (This is a technical construction needed to make the Zermelo-Frankel set theory compatible with the dependent type theory of Lean.) - The specification
A.specify Pof a setAand a predicateP: A.toSubtype → Propto the subset of elements ofAobeyingP, and the axiom of specification. TODO: somehow implement set builder elaboration for this. - The replacement
A.replace hPof a setAvia a predicateP: A.toSubtype → Object → Propobeying a uniqueness condition∀ x y y', P x y ∧ P x y' → y = y', and the axiom of replacement. - A bijective correspondence between the Mathlib natural numbers
ℕand a setChapter3.Nat : Chapter3.Set(the axiom of infinity).
The other axioms of Zermelo-Frankel set theory are discussed in later sections.
Some technical notes:
- Mathlib of course has its own notion of a
Set, which is not compatible with the notionChapter3.Setdefined here, though we will try to make the notations match as much as possible. This causes some notational conflict: for instance, one may need to explicitly specify(∅:Chapter3.Set)instead of just∅to indicate that one is using theChapter3.Setversion of the empty set, rather than the Mathlib version of the empty set, and similarly for other notation defined here. - In Analysis I, we chose to work with an "impure" set theory, in which there could be more
Objects than justSets. In the type theory of Lean, this requires treatingChapter3.SetandChapter3.Objectas distinct types. Occasionally this means we have to use a coercionX.toObjectof aChapter3.SetXto make into aChapter3.Object: this is mostly needed when manipulating sets of sets. - After this chapter is concluded, the notion of a
Chapter3.Setwill be deprecated in favor of the standard Mathlib notion of aSet(or more precisely of the typeSet Xof a set in a given typeX). However, due to various technical incompatibilities between set theory and type theory, we will not attempt to create any sort of equivalence between these two notions of sets. (As such, this makes this entire chapter optional from the point of view of the rest of the book, though we retain it for pedagogical purposes.)
Some of the axioms of Zermelo-Frankel theory with atoms
Instances
Definition 3.1.1 (objects can be elements of sets)
Equations
- Chapter3.objects_mem_sets = { mem := fun (X : Chapter3.Set) (x : Chapter3.Object) => Chapter3.SetTheory.mem x X }
Axiom 3.1 (Sets are objects)
Equations
- Chapter3.sets_are_objects = { coe := fun (X : Chapter3.Set) => Chapter3.SetTheory.set_to_object X }
Equations
Instances For
Equations
- Chapter3.Set.empty_inst = { emptyCollection := Chapter3.SetTheory.emptyset }
Axiom 3.3 (empty set). Note: one may have to explicitly cast ∅ to Set due to Mathlib's existing set theory notation.
Equations
- Chapter3.Set.singleton_inst = { singleton := Chapter3.SetTheory.singleton }
Equations
Equations
- Chapter3.Set.insert_inst = { insert := fun (x : Chapter3.Object) (X : Chapter3.Set) => {x} ∪ X }
Equations
Instances For
Instances For
Equations
Instances For
Exercise 3.1.2
Exercise 3.1.2
Definition 3.1.14.
Equations
- Chapter3.Set.subset_inst = { Subset := fun (X Y : Chapter3.Set) => ∀ x ∈ X, x ∈ Y }
Definition 3.1.14. Note that the strict subset operation in Mathlib is denoted ⊂ rather than ⊊.
Equations
- Chapter3.Set.strict_subset_inst = { SSubset := fun (X Y : Chapter3.Set) => X ⊆ Y ∧ X ≠ Y }
This defines the subtype A.toSubtype for any A:Set. To produce an element x' of this subtype, use ⟨ x, hx ⟩, where x:Object and hx:x ∈ A. The object x associated to a subtype element x' is recovered as x.val, and the property hx that x belongs to A is recovered as x.property
Instances For
Equations
- Chapter3.instCoeSortSetType = { coe := fun (A : Chapter3.Set) => A.toSubtype }
If one has a proof hx of x ∈ A, then A.subtype_mk hx will then make the element of A (viewed as a subtype) corresponding to x.
Equations
- A.subtype_mk hx = ⟨x, hx⟩
Instances For
Equations
- Chapter3.Set.intersection_inst = { inter := fun (X Y : Chapter3.Set) => X.specify fun (x : X.toSubtype) => ↑x ∈ Y }
Equations
- Chapter3.Set.sdiff_inst = { sdiff := fun (X Y : Chapter3.Set) => X.specify fun (x : X.toSubtype) => ↑x ∉ Y }
Not from textbook: sets form a distributive lattice.
Equations
- One or more equations did not get rendered due to their size.
Sets have a minimal element.
Equations
- Chapter3.Set.orderBot_inst = { bot := ∅, bot_le := ⋯ }
Equations
Instances For
Axiom 3.8 (Axiom of infinity)
Instances For
Equations
- Chapter3.Set.ofnat_inst = { ofNat := Chapter3.Set.nat_equiv n }
Equations
- Chapter3.Set.natCast_inst = { natCast := fun (n : ℕ) => Chapter3.Set.nat_equiv n }
Equations
- Chapter3.Set.toNat = { coe := fun (n : Chapter3.Nat.toSubtype) => Chapter3.Set.nat_equiv.symm n }
Equations
- Chapter3.Object.natCast_inst = { natCast := fun (n : ℕ) => ↑↑n }
Equations
- Chapter3.Object.ofnat_inst = { ofNat := ↑↑n }
Exercise 3.1.11. The challenge is to prove this without using Set.specify, Set.specification_axiom, or Set.specification_axiom'.