Documentation

Analysis.Section_3_1

Analysis I, Section 3.1: Fundamentals (of set theory) #

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:

The other axioms of Zermelo-Frankel set theory are discussed in later sections.

Some technical notes:

Tips from past users #

Users of the companion who have completed the exercises in this section are welcome to send their tips for future users in this section as PRs.

class Chapter3.SetTheory :
Type (max (u + 1) (v + 1))

The axioms of Zermelo-Frankel theory with atoms.

Instances

    Definition 3.1.1 (objects can be elements of sets)

    Equations

    Axiom 3.1 (Sets are objects)

    @[simp]

    Axiom 3.1 (Sets are objects)

    theorem Chapter3.SetTheory.Set.ext [SetTheory] {X Y : Set} (h : ∀ (x : Object), x X x Y) :
    X = Y

    Axiom 3.2 (Equality of sets). The [ext] tag allows the ext tactic to work for sets.

    theorem Chapter3.SetTheory.Set.ext_iff [SetTheory] {X Y : Set} :
    X = Y ∀ (x : Object), x X x Y
    @[simp]

    Axiom 3.3 (empty set). Note: in some applications one may have to explicitly cast ∅ to Set due to Mathlib's existing set theory notation.

    Empty set has no elements

    Empty set is unique

    theorem Chapter3.SetTheory.Set.nonempty_def [SetTheory] {X : Set} (h : X ) :
    ∃ (x : Object), x X

    Lemma 3.1.5 (Single choice)

    @[simp]

    Axiom 3.3(a) (singleton). Note: in some applications one may have to explicitly cast {a} to Set due to Mathlib's existing set theory notation.

    @[simp]
    theorem Chapter3.SetTheory.Set.mem_union [SetTheory] (x : Object) (X Y : Set) :
    x X Y x X x Y

    Axiom 3.4 (Pairwise union)

    @[simp]
    theorem Chapter3.SetTheory.Set.mem_insert [SetTheory] (a b : Object) (X : Set) :
    a insert b X a = b a X

    Axiom 3.3(b) (pair). Note: in some applications one may have to cast {a,b} to Set.

    @[simp]
    theorem Chapter3.SetTheory.Set.mem_pair [SetTheory] (x a b : Object) :
    x {a, b} x = a x = b

    Axiom 3.3(b) (pair). Note: in some applications one may have to cast {a,b} to Set.

    @[simp]
    theorem Chapter3.SetTheory.Set.mem_triple [SetTheory] (x a b c : Object) :
    x {a, b, c} x = a x = b x = c

    Remark 3.1.9

    theorem Chapter3.SetTheory.Set.pair_uniq [SetTheory] (a b : Object) :
    ∃! X : Set, ∀ (x : Object), x X x = a x = b

    Remark 3.1.9

    Remark 3.1.9

    @[simp]

    Remark 3.1.9

    theorem Chapter3.SetTheory.Set.pair_eq_pair [SetTheory] {a b c d : Object} (h : {a, b} = {c, d}) :
    a = c b = d a = d b = c

    Exercise 3.1.1

    @[reducible, inline]
    Equations
    Instances For
      theorem Chapter3.SetTheory.Set.union_congr_left [SetTheory] (A A' B : Set) (h : A = A') :
      A B = A' B

      Remark 3.1.11. (These results can be proven either by a direct rewrite, or by using extensionality.)

      theorem Chapter3.SetTheory.Set.union_congr_right [SetTheory] (A B B' : Set) (h : B = B') :
      A B = A B'

      Remark 3.1.11. (These results can be proven either by a direct rewrite, or by using extensionality.)

      Lemma 3.1.12 (Basic properties of unions) / Exercise 3.1.3

      Lemma 3.1.12 (Basic properties of unions) / Exercise 3.1.3

      theorem Chapter3.SetTheory.Set.union_assoc [SetTheory] (A B C : Set) :
      A B C = A (B C)

      Lemma 3.1.12 (Basic properties of unions) / Exercise 3.1.3

      @[simp]

      Proposition 3.1.27(c)

      @[simp]

      Proposition 3.1.27(a)

      @[simp]

      Proposition 3.1.27(a)

      Example 3.1.10

      Definition 3.1.14.

      Equations

      Definition 3.1.14. Note that the strict subset operation in Mathlib is denoted rather than .

      Equations
      theorem Chapter3.SetTheory.Set.subset_def [SetTheory] (X Y : Set) :
      X Y xX, x Y

      Definition 3.1.14.

      Definition 3.1.14. Note that the strict subset operation in Mathlib is denoted rather than .

      theorem Chapter3.SetTheory.Set.subset_congr_left [SetTheory] {A A' B : Set} (hAA' : A = A') (hAB : A B) :
      A' B

      Remark 3.1.15

      @[simp]

      Examples 3.1.16

      @[simp]

      Examples 3.1.16

      theorem Chapter3.SetTheory.Set.subset_trans [SetTheory] {A B C : Set} (hAB : A B) (hBC : B C) :
      A C

      Proposition 3.1.17 (Partial ordering by set inclusion)

      theorem Chapter3.SetTheory.Set.subset_antisymm [SetTheory] (A B : Set) (hAB : A B) (hBA : B A) :
      A = B

      Proposition 3.1.17 (Partial ordering by set inclusion)

      theorem Chapter3.SetTheory.Set.ssubset_trans [SetTheory] (A B C : Set) (hAB : A B) (hBC : B C) :
      A C

      Proposition 3.1.17 (Partial ordering by set inclusion)

      @[reducible, inline]

      This defines the subtype A.toSubtype for any A:Set. Note that A.toSubtype gives you a type, similar to how Object or Set are types. A value x' of type A.toSubtype combines some x: Object with a proof that hx: x ∈ A.

      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.

      Equations
      Instances For

        Elements of a set (implicitly coerced to a subtype) are also elements of the set (with respect to the membership operation of the set theory).

        theorem Chapter3.SetTheory.Set.coe_inj [SetTheory] (A : Set) (x y : A.toSubtype) :
        x = y x = y

        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
        Instances For
          @[simp]
          theorem Chapter3.SetTheory.Set.subtype_mk_coe [SetTheory] {A : Set} {x : Object} (hx : x A) :
          (A.subtype_mk hx) = x
          @[reducible, inline]
          Equations
          Instances For
            theorem Chapter3.SetTheory.Set.specification_axiom [SetTheory] {A : Set} {P : A.toSubtypeProp} {x : Object} (h : x A.specify P) :
            x A

            Axiom 3.6 (axiom of specification)

            Axiom 3.6 (axiom of specification)

            @[simp]
            theorem Chapter3.SetTheory.Set.specification_axiom'' [SetTheory] {A : Set} (P : A.toSubtypeProp) (x : Object) :
            x A.specify P ∃ (h : x A), P x, h

            Axiom 3.6 (axiom of specification)

            theorem Chapter3.SetTheory.Set.specify_congr [SetTheory] {A A' : Set} (hAA' : A = A') {P : A.toSubtypeProp} {P' : A'.toSubtypeProp} (hPP' : ∀ (x : Object) (h : x A) (h' : x A'), P x, h P' x, h') :
            A.specify P = A'.specify P'

            This exercise may require some understanding of how subtypes are implemented in Lean.

            @[simp]
            theorem Chapter3.SetTheory.Set.mem_inter [SetTheory] (x : Object) (X Y : Set) :
            x X Y x X x Y

            Definition 3.1.22 (Intersections)

            Equations
            @[simp]
            theorem Chapter3.SetTheory.Set.mem_sdiff [SetTheory] (x : Object) (X Y : Set) :
            x X \ Y x X xY

            Definition 3.1.26 (Difference sets)

            Proposition 3.1.27(d) / Exercise 3.1.6

            theorem Chapter3.SetTheory.Set.subset_union [SetTheory] {A X : Set} (hAX : A X) :
            A X = X

            Proposition 3.1.27(b)

            theorem Chapter3.SetTheory.Set.union_subset [SetTheory] {A X : Set} (hAX : A X) :
            X A = X

            Proposition 3.1.27(b)

            @[simp]

            Proposition 3.1.27(c)

            theorem Chapter3.SetTheory.Set.inter_assoc [SetTheory] (A B C : Set) :
            A B C = A (B C)

            Proposition 3.1.27(e)

            Proposition 3.1.27(f)

            Proposition 3.1.27(f)

            theorem Chapter3.SetTheory.Set.union_compl [SetTheory] {A X : Set} (hAX : A X) :
            A X \ A = X

            Proposition 3.1.27(f)

            Proposition 3.1.27(f)

            theorem Chapter3.SetTheory.Set.compl_union [SetTheory] {A B X : Set} :
            X \ (A B) = X \ A (X \ B)

            Proposition 3.1.27(g)

            theorem Chapter3.SetTheory.Set.compl_inter [SetTheory] {A B X : Set} :
            X \ (A B) = X \ A X \ B

            Proposition 3.1.27(g)

            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

            Definition of disjointness (using the previous instances)

            @[reducible, inline]
            abbrev Chapter3.SetTheory.Set.replace [SetTheory] (A : Set) {P : A.toSubtypeObjectProp} (hP : ∀ (x : A.toSubtype) (y y' : Object), P x y P x y'y = y') :
            Equations
            Instances For
              @[simp]
              theorem Chapter3.SetTheory.Set.replacement_axiom [SetTheory] {A : Set} {P : A.toSubtypeObjectProp} (hP : ∀ (x : A.toSubtype) (y y' : Object), P x y P x y'y = y') (y : Object) :
              y A.replace hP ∃ (x : A.toSubtype), P x y

              Axiom 3.7 (Axiom of replacement)

              @[reducible, inline]
              Equations
              Instances For
                @[simp]
                theorem Chapter3.SetTheory.Object.ofnat_eq [SetTheory] {n : } :
                n = n
                @[simp]
                theorem Chapter3.SetTheory.Set.nat_equiv_inj [SetTheory] (n m : ) :
                n = m n = m
                @[simp]
                theorem Chapter3.SetTheory.Object.natCast_inj [SetTheory] (n m : ) :
                n = m n = m

                Exercise 3.1.5. One can use the tfae_have and tfae_finish tactics here.

                Exercise 3.1.7

                @[simp]

                Exercise 3.1.7

                Exercise 3.1.7

                @[simp]

                Exercise 3.1.7

                @[simp]

                Exercise 3.1.8

                @[simp]

                Exercise 3.1.8

                theorem Chapter3.SetTheory.Set.partition_left [SetTheory] {A B X : Set} (h_union : A B = X) (h_inter : A B = ) :
                A = X \ B

                Exercise 3.1.9

                theorem Chapter3.SetTheory.Set.partition_right [SetTheory] {A B X : Set} (h_union : A B = X) (h_inter : A B = ) :
                B = X \ A

                Exercise 3.1.9

                Exercise 3.1.10. You may find Function.onFun_apply and the fin_cases tactic useful.

                Exercise 3.1.10

                theorem Chapter3.SetTheory.Set.specification_from_replacement [SetTheory] {A : Set} {P : A.toSubtypeProp} :
                BA, ∀ (x : A.toSubtype), x B P x

                Exercise 3.1.11. The challenge is to prove this without using Set.specify, Set.specification_axiom, Set.specification_axiom', or anything built from them (like differences and intersections).

                theorem Chapter3.SetTheory.Set.subset_union_subset [SetTheory] {A B A' B' : Set} (hA'A : A' A) (hB'B : B' B) :
                A' B' A B

                Exercise 3.1.12.

                theorem Chapter3.SetTheory.Set.subset_inter_subset [SetTheory] {A B A' B' : Set} (hA'A : A' A) (hB'B : B' B) :
                A' B' A B

                Exercise 3.1.12.

                theorem Chapter3.SetTheory.Set.subset_diff_subset_counter [SetTheory] :
                ∃ (A : Set) (B : Set) (A' : Set) (B' : Set), A' A B' B ¬A' \ B' A \ B

                Exercise 3.1.12.

                theorem Chapter3.SetTheory.Set.singleton_iff [SetTheory] (A : Set) (hA : A ) :
                (¬BA, B ) ∃ (x : Object), A = {x}

                Exercise 3.1.13

                @[simp]

                Injectivity of the coercion. Note however that we do NOT assert that the coercion is surjective (and indeed Russell's paradox prevents this)

                Compatibility of the membership operation ∈

                Compatibility of the emptyset

                Compatibility of subset

                Compatibility of singleton

                Compatibility of union

                Compatibility of pair

                Compatibility of subtype

                Compatibility of intersection

                Compatibility of set difference

                Compatibility of disjointness