Documentation

Mathlib.SetTheory.ZFC.Basic

A model of ZFC #

In this file, we model Zermelo-Fraenkel set theory (+ choice) using Lean's underlying type theory, building on the pre-sets defined in Mathlib/SetTheory/ZFC/PSet.lean.

The theory of classes is developed in Mathlib/SetTheory/ZFC/Class.lean.

Main definitions #

Notes #

To avoid confusion between the Lean Set and the ZFC Set, docstrings in this file refer to them respectively as "Set" and "ZFC set".

def ZFSet :
Type (u + 1)

The ZFC universe of sets consists of the type of pre-sets, quotiented by extensional equivalence.

Equations
Instances For

    Turns a pre-set into a ZFC set.

    Equations
    Instances For
      @[simp]
      theorem ZFSet.mk_eq (x : PSet.{u_1}) :
      @[simp]
      class ZFSet.Definable (n : ℕ) (f : (Fin n → ZFSet.{u}) → ZFSet.{u}) :
      Type (u + 1)

      A set function is "definable" if it is the image of some n-ary PSet function. This isn't exactly definability, but is useful as a sufficient condition for functions that have a computable image.

      Instances
        @[reducible, inline]
        abbrev ZFSet.Definable₁ (f : ZFSet.{u} → ZFSet.{u}) :
        Type (u + 1)

        An abbrev of ZFSet.Definable for unary functions.

        Equations
        Instances For
          @[reducible, inline]
          abbrev ZFSet.Definable₁.mk {f : ZFSet.{u} → ZFSet.{u}} (out : PSet.{u} → PSet.{u}) (mk_out : ∀ (x : PSet.{u}), ⟦out x⟧ = f ⟦x⟧) :

          A simpler constructor for ZFSet.Definable₁.

          Equations
          Instances For
            @[reducible, inline]

            Turns a unary definable function into a unary PSet function.

            Equations
            Instances For
              @[reducible, inline]
              abbrev ZFSet.Definable₂ (f : ZFSet.{u} → ZFSet.{u} → ZFSet.{u}) :
              Type (u + 1)

              An abbrev of ZFSet.Definable for binary functions.

              Equations
              Instances For
                @[reducible, inline]
                abbrev ZFSet.Definable₂.mk {f : ZFSet.{u} → ZFSet.{u} → ZFSet.{u}} (out : PSet.{u} → PSet.{u} → PSet.{u}) (mk_out : ∀ (x y : PSet.{u}), ⟦out x y⟧ = f ⟦x⟧ ⟦y⟧) :

                A simpler constructor for ZFSet.Definable₂.

                Equations
                Instances For
                  @[reducible, inline]

                  Turns a binary definable function into a binary PSet function.

                  Equations
                  Instances For
                    @[instance_reducible]
                    instance ZFSet.instDefinableOfDefinable₁ (f : ZFSet.{u_1} → ZFSet.{u_1}) [Definable₁ f] (n : ℕ) (g : (Fin n → ZFSet.{u_1}) → ZFSet.{u_1}) [Definable n g] :
                    Definable n fun (s : Fin n → ZFSet.{u_1}) => f (g s)
                    Equations
                    @[instance_reducible]
                    instance ZFSet.instDefinableOfDefinable₂ (f : ZFSet.{u_1} → ZFSet.{u_1} → ZFSet.{u_1}) [Definable₂ f] (n : ℕ) (g₁ g₂ : (Fin n → ZFSet.{u_1}) → ZFSet.{u_1}) [Definable n g₁] [Definable n g₂] :
                    Definable n fun (s : Fin n → ZFSet.{u_1}) => f (g₁ s) (g₂ s)
                    Equations
                    @[instance_reducible]
                    instance ZFSet.instDefinable (n : ℕ) (i : Fin n) :
                    Definable n fun (s : Fin n → ZFSet.{u_1}) => s i
                    Equations
                    theorem ZFSet.Definable.out_equiv {n : ℕ} (f : (Fin n → ZFSet.{u}) → ZFSet.{u}) [Definable n f] {xs ys : Fin n → PSet.{u}} (h : ∀ (i : Fin n), xs i ≈ ys i) :
                    out f xs ≈ out f ys
                    theorem ZFSet.Definable₁.out_equiv (f : ZFSet.{u} → ZFSet.{u}) [Definable₁ f] {x y : PSet.{u}} (h : x ≈ y) :
                    out f x ≈ out f y
                    theorem ZFSet.Definable₂.out_equiv (f : ZFSet.{u} → ZFSet.{u} → ZFSet.{u}) [Definable₂ f] {x₁ y₁ x₂ y₂ : PSet.{u}} (h₁ : x₁ ≈ y₁) (h₂ : x₂ ≈ y₂) :
                    out f x₁ x₂ ≈ out f y₁ y₂
                    @[instance_reducible]
                    noncomputable def Classical.allZFSetDefinable {n : ℕ} (F : (Fin n → ZFSet.{u}) → ZFSet.{u}) :

                    All functions are classically definable.

                    Equations
                    Instances For
                      theorem ZFSet.eq {x y : PSet.{u_1}} :
                      mk x = mk y ↔ x.Equiv y
                      theorem ZFSet.sound {x y : PSet.{u_1}} (h : x.Equiv y) :
                      mk x = mk y
                      theorem ZFSet.exact {x y : PSet.{u_1}} :
                      mk x = mk y → x.Equiv y

                      Convert a ZFC set into a Set of ZFC sets

                      Equations
                      Instances For
                        @[instance_reducible]
                        Equations
                        @[deprecated "use `∈` notation" (since := "2026-03-16")]

                        The membership relation for ZFC sets is inherited from the membership relation for pre-sets.

                        Equations
                        • x1✝.Mem x2✝ = (x1✝ ∈ x2✝)
                        Instances For
                          @[simp]
                          theorem ZFSet.mk_mem_iff {x y : PSet.{u_1}} :
                          mk x ∈ mk y ↔ x ∈ y
                          theorem ZFSet.ext {x y : ZFSet.{u}} :
                          (∀ (z : ZFSet.{u}), z ∈ x ↔ z ∈ y) → x = y
                          theorem ZFSet.ext_iff {x y : ZFSet.{u}} :
                          x = y ↔ ∀ (z : ZFSet.{u}), z ∈ x ↔ z ∈ y

                          A nonempty set is one that contains some element.

                          Equations
                          Instances For
                            @[simp]
                            @[deprecated "This is now a syntactic equality" (since := "2026-03-18")]
                            theorem ZFSet.le_def {x y : ZFSet.{u}} :
                            x ⊆ y ↔ x ⊆ y
                            @[deprecated "This is now a syntactic equality" (since := "2026-03-18")]
                            theorem ZFSet.lt_def {x y : ZFSet.{u}} :
                            x ⊂ y ↔ x ⊂ y
                            theorem ZFSet.subset_def {x y : ZFSet.{u}} :
                            x ⊆ y ↔ ∀ ⦃z : ZFSet.{u}⦄, z ∈ x → z ∈ y
                            instance ZFSet.instReflLe :
                            Std.Refl fun (x1 x2 : ZFSet.{u_1}) => x1 ⊆ x2
                            instance ZFSet.instIsTransLe :
                            IsTrans ZFSet.{u_1} fun (x1 x2 : ZFSet.{u_1}) => x1 ⊆ x2
                            @[simp]
                            theorem ZFSet.subset_iff {x y : PSet.{u_1}} :
                            mk x ⊆ mk y ↔ x ⊆ y
                            theorem ZFSet.coe_subset_coe {x y : ZFSet.{u}} :
                            ↑x ⊆ ↑y ↔ x ⊆ y
                            instance ZFSet.instAntisymmLe :
                            Std.Antisymm fun (x1 x2 : ZFSet.{u_1}) => x1 ⊆ x2
                            instance ZFSet.instIsNonstrictStrictOrderLeLt :
                            IsNonstrictStrictOrder ZFSet.{u_1} (fun (x1 x2 : ZFSet.{u_1}) => x1 ⊆ x2) fun (x1 x2 : ZFSet.{u_1}) => x1 ⊂ x2

                            The empty ZFC set

                            Equations
                            Instances For
                              @[instance_reducible]
                              Equations
                              @[instance_reducible]
                              Equations
                              @[simp]
                              theorem ZFSet.notMem_empty (x : ZFSet.{u}) :
                              x ∉ ∅
                              @[simp]
                              theorem ZFSet.coe_empty :
                              ↑∅ = ∅
                              @[simp]
                              theorem ZFSet.empty_subset (x : ZFSet.{u}) :
                              ∅ ⊆ x
                              theorem ZFSet.eq_empty (x : ZFSet.{u}) :
                              x = ∅ ↔ ∀ (y : ZFSet.{u}), y ∉ x
                              @[instance_reducible]
                              Equations
                              @[instance_reducible]
                              Equations
                              @[simp]
                              theorem ZFSet.mem_insert_iff {x y z : ZFSet.{u}} :
                              x ∈ insert y z ↔ x = y ∨ x ∈ z
                              theorem ZFSet.mem_insert_of_mem {y z : ZFSet.{u_1}} (x : ZFSet.{u_1}) (h : z ∈ y) :
                              z ∈ insert x y
                              @[simp]
                              theorem ZFSet.coe_insert (x y : ZFSet.{u_1}) :
                              ↑(insert x y) = insert x ↑y
                              @[simp]
                              theorem ZFSet.mem_singleton {x y : ZFSet.{u}} :
                              x ∈ {y} ↔ x = y
                              theorem ZFSet.notMem_singleton {x y : ZFSet.{u}} :
                              x ∉ {y} ↔ x ≠ y
                              @[simp]
                              theorem ZFSet.coe_singleton (x : ZFSet.{u_1}) :
                              ↑{x} = {x}
                              theorem ZFSet.mem_pair {x y z : ZFSet.{u}} :
                              x ∈ {y, z} ↔ x = y ∨ x = z
                              @[simp]
                              @[simp]
                              theorem ZFSet.pair_eq_singleton_iff {x y z : ZFSet.{u_1}} :
                              {x, y} = {z} ↔ x = z ∧ y = z
                              @[simp]
                              theorem ZFSet.singleton_eq_pair_iff {x y z : ZFSet.{u_1}} :
                              {x} = {y, z} ↔ x = y ∧ x = z

                              omega is the first infinite von Neumann ordinal

                              Equations
                              Instances For
                                @[simp]

                                {x ∈ a | p x} is the set of elements in a satisfying p

                                Equations
                                Instances For
                                  @[instance_reducible]
                                  Equations
                                  @[simp]
                                  theorem ZFSet.mem_sep {p : ZFSet.{u} → Prop} {x y : ZFSet.{u}} :
                                  y ∈ ZFSet.sep p x ↔ y ∈ x ∧ p y
                                  @[simp]
                                  theorem ZFSet.sep_subset {x : ZFSet.{u_1}} {p : ZFSet.{u_1} → Prop} :
                                  ZFSet.sep p x ⊆ x
                                  @[simp]
                                  theorem ZFSet.coe_sep (a : ZFSet.{u_1}) (p : ZFSet.{u_1} → Prop) :
                                  ↑(ZFSet.sep p a) = {x : ZFSet.{u_1} | x ∈ a ∧ p x}

                                  The powerset operation, the collection of subsets of a ZFC set

                                  Equations
                                  Instances For
                                    @[simp]
                                    theorem ZFSet.mem_powerset {x y : ZFSet.{u}} :
                                    y ∈ x.powerset ↔ y ⊆ x
                                    theorem ZFSet.sUnion_lem {α β : Type u} (A : α → PSet.{u}) (B : β → PSet.{u}) (αβ : ∀ (a : α), ∃ (b : β), (A a).Equiv (B b)) (a : (⋃₀ PSet.mk α A).Type) :
                                    ∃ (b : (⋃₀ PSet.mk β B).Type), ((⋃₀ PSet.mk α A).Func a).Equiv ((⋃₀ PSet.mk β B).Func b)

                                    The union operator, the collection of elements of elements of a ZFC set. Uses ⋃₀ notation, scoped under the ZFSet namespace.

                                    Equations
                                    Instances For

                                      The union operator, the collection of elements of elements of a ZFC set. Uses ⋃₀ notation, scoped under the ZFSet namespace.

                                      Equations
                                      Instances For

                                        The intersection operator, the collection of elements in all of the elements of a ZFC set. We define ⋂₀ ∅ = ∅. Uses ⋂₀ notation, scoped under the ZFSet namespace.

                                        Equations
                                        Instances For

                                          The intersection operator, the collection of elements in all of the elements of a ZFC set. We define ⋂₀ ∅ = ∅. Uses ⋂₀ notation, scoped under the ZFSet namespace.

                                          Equations
                                          Instances For
                                            @[simp]
                                            theorem ZFSet.mem_sUnion {x y : ZFSet.{u}} :
                                            y ∈ x.sUnion ↔ ∃ z ∈ x, y ∈ z
                                            theorem ZFSet.mem_sInter {x y : ZFSet.{u_1}} (h : x.Nonempty) :
                                            y ∈ x.sInter ↔ ∀ z ∈ x, y ∈ z
                                            theorem ZFSet.mem_of_mem_sInter {x y z : ZFSet.{u_1}} (hy : y ∈ x.sInter) (hz : z ∈ x) :
                                            y ∈ z
                                            theorem ZFSet.mem_sUnion_of_mem {x y z : ZFSet.{u_1}} (hy : y ∈ z) (hz : z ∈ x) :
                                            theorem ZFSet.notMem_sInter_of_notMem {x y z : ZFSet.{u_1}} (hy : y ∉ z) (hz : z ∈ x) :
                                            y ∉ x.sInter
                                            @[simp]
                                            @[simp]
                                            theorem ZFSet.coe_sInter {x : ZFSet.{u}} (h : x.Nonempty) :
                                            @[simp]
                                            theorem ZFSet.singleton_inj {x y : ZFSet.{u_1}} :
                                            {x} = {y} ↔ x = y

                                            The binary union operation

                                            Equations
                                            Instances For

                                              The binary intersection operation

                                              Equations
                                              Instances For

                                                The set difference operation

                                                Equations
                                                Instances For
                                                  @[instance_reducible]
                                                  Equations
                                                  @[instance_reducible]
                                                  Equations
                                                  @[instance_reducible]
                                                  Equations
                                                  @[simp]
                                                  theorem ZFSet.sUnion_pair (x y : ZFSet.{u}) :
                                                  {x, y}.sUnion = x ∪ y
                                                  @[simp]
                                                  theorem ZFSet.sep_mem (x y : ZFSet.{u}) :
                                                  ZFSet.sep (fun (x : ZFSet.{u}) => x ∈ y) x = x ∩ y
                                                  @[simp]
                                                  theorem ZFSet.sep_notMem (x y : ZFSet.{u}) :
                                                  ZFSet.sep (fun (x : ZFSet.{u}) => x ∉ y) x = x \ y
                                                  @[simp]
                                                  theorem ZFSet.mem_union {x y z : ZFSet.{u}} :
                                                  z ∈ x ∪ y ↔ z ∈ x ∨ z ∈ y
                                                  @[simp]
                                                  theorem ZFSet.mem_inter {x y z : ZFSet.{u}} :
                                                  z ∈ x ∩ y ↔ z ∈ x ∧ z ∈ y
                                                  @[simp]
                                                  theorem ZFSet.mem_sdiff {x y z : ZFSet.{u}} :
                                                  z ∈ x \ y ↔ z ∈ x ∧ z ∉ y
                                                  @[simp]
                                                  theorem ZFSet.coe_union (x y : ZFSet.{u}) :
                                                  ↑(x ∪ y) = ↑x ∪ ↑y
                                                  @[simp]
                                                  theorem ZFSet.coe_inter (x y : ZFSet.{u}) :
                                                  ↑(x ∩ y) = ↑x ∩ ↑y
                                                  @[simp]
                                                  theorem ZFSet.coe_sdiff (x y : ZFSet.{u}) :
                                                  ↑(x \ y) = ↑x \ ↑y
                                                  @[simp]
                                                  theorem ZFSet.inter_eq_left_of_subset {x y : ZFSet.{u}} (hxy : x ⊆ y) :
                                                  x ∩ y = x
                                                  @[simp]
                                                  theorem ZFSet.inter_eq_right_of_subset {x y : ZFSet.{u}} (hyx : y ⊆ x) :
                                                  x ∩ y = y
                                                  def ZFSet.powersetEquiv (x : ZFSet.{u}) :
                                                  ↥x.powerset ≃ ↑(𝒫 ↑x)

                                                  ZFSet.powerset is equivalent to Set.powerset.

                                                  Equations
                                                  Instances For
                                                    theorem ZFSet.mem_wf :
                                                    WellFounded fun (x1 x2 : ZFSet.{u_1}) => x1 ∈ x2
                                                    theorem ZFSet.inductionOn {p : ZFSet.{u_1} → Prop} (x : ZFSet.{u_1}) (h : ∀ (x : ZFSet.{u_1}), (∀ y ∈ x, p y) → p x) :
                                                    p x

                                                    Induction on the ∈ relation.

                                                    @[instance_reducible]
                                                    Equations
                                                    theorem ZFSet.mem_asymm {x y : ZFSet.{u_1}} :
                                                    x ∈ y → y ∉ x
                                                    theorem ZFSet.mem_irrefl (x : ZFSet.{u_1}) :
                                                    x ∉ x
                                                    theorem ZFSet.not_subset_of_mem {x y : ZFSet.{u_1}} (h : x ∈ y) :
                                                    ¬y ⊆ x
                                                    theorem ZFSet.notMem_of_subset {x y : ZFSet.{u_1}} (h : x ⊆ y) :
                                                    y ∉ x
                                                    theorem ZFSet.regularity (x : ZFSet.{u}) (h : x ≠ ∅) :
                                                    ∃ y ∈ x, x ∩ y = ∅

                                                    The image of a (definable) ZFC set function

                                                    Equations
                                                    Instances For
                                                      theorem ZFSet.image.mk (f : ZFSet.{u} → ZFSet.{u}) [Definable₁ f] (x : ZFSet.{u}) {y : ZFSet.{u}} :
                                                      y ∈ x → f y ∈ image f x
                                                      @[simp]
                                                      theorem ZFSet.mem_image {f : ZFSet.{u} → ZFSet.{u}} [Definable₁ f] {x y : ZFSet.{u}} :
                                                      y ∈ image f x ↔ ∃ z ∈ x, f z = y
                                                      @[simp]
                                                      theorem ZFSet.coe_image (f : ZFSet.{u_1} → ZFSet.{u_1}) [Definable₁ f] (x : ZFSet.{u_1}) :
                                                      ↑(image f x) = f '' ↑x
                                                      noncomputable def ZFSet.range {α : Type u_1} [Small.{u, u_1} α] (f : α → ZFSet.{u}) :

                                                      The range of a type-indexed family of sets.

                                                      Equations
                                                      Instances For
                                                        @[simp]
                                                        theorem ZFSet.mem_range {α : Type u_1} [Small.{u, u_1} α] {f : α → ZFSet.{u}} {x : ZFSet.{u}} :
                                                        x ∈ range f ↔ ∃ (i : α), f i = x
                                                        @[simp]
                                                        theorem ZFSet.coe_range {α : Type u_1} [Small.{u, u_1} α] (f : α → ZFSet.{u}) :
                                                        ↑(range f) = Set.range f
                                                        theorem ZFSet.mem_range_self {α : Type u_1} [Small.{u, u_1} α] {f : α → ZFSet.{u}} (a : α) :
                                                        f a ∈ range f
                                                        noncomputable def ZFSet.iUnion {α : Type u_1} [Small.{u, u_1} α] (f : α → ZFSet.{u}) :

                                                        Indexed union of a family of ZFC sets. Uses ⋃ notation, scoped under the ZFSet namespace.

                                                        Equations
                                                        Instances For

                                                          Indexed union of a family of ZFC sets. Uses ⋃ notation, scoped under the ZFSet namespace.

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            @[simp]
                                                            theorem ZFSet.mem_iUnion {α : Type u_1} [Small.{u, u_1} α] {f : α → ZFSet.{u}} {x : ZFSet.{u}} :
                                                            (x ∈ iUnion fun (i : α) => f i) ↔ ∃ (i : α), x ∈ f i
                                                            @[simp]
                                                            theorem ZFSet.coe_iUnion {α : Type u_1} [Small.{u, u_1} α] (f : α → ZFSet.{u}) :
                                                            ↑(iUnion fun (i : α) => f i) = ⋃ (i : α), ↑(f i)
                                                            theorem ZFSet.subset_iUnion {α : Type u_1} [Small.{u, u_1} α] (f : α → ZFSet.{u}) (i : α) :
                                                            f i ⊆ iUnion fun (i : α) => f i

                                                            Kuratowski ordered pair

                                                            Equations
                                                            Instances For
                                                              @[simp]
                                                              theorem ZFSet.coe_pair (x y : ZFSet.{u}) :
                                                              ↑(x.pair y) = {{x}, {x, y}}

                                                              A subset of pairs {(a, b) ∈ x × y | p a b}

                                                              Equations
                                                              Instances For
                                                                @[simp]
                                                                theorem ZFSet.mem_pairSep {p : ZFSet.{u} → ZFSet.{u} → Prop} {x y z : ZFSet.{u}} :
                                                                z ∈ pairSep p x y ↔ ∃ a ∈ x, ∃ b ∈ y, z = a.pair b ∧ p a b
                                                                @[simp]
                                                                theorem ZFSet.pair_inj {x y x' y' : ZFSet.{u_1}} :
                                                                x.pair y = x'.pair y' ↔ x = x' ∧ y = y'

                                                                The Cartesian product, {(a, b) | a ∈ x, b ∈ y}

                                                                Equations
                                                                Instances For
                                                                  @[simp]
                                                                  theorem ZFSet.mem_prod {x y z : ZFSet.{u}} :
                                                                  z ∈ x.prod y ↔ ∃ a ∈ x, ∃ b ∈ y, z = a.pair b
                                                                  theorem ZFSet.pair_mem_prod {x y a b : ZFSet.{u}} :
                                                                  a.pair b ∈ x.prod y ↔ a ∈ x ∧ b ∈ y
                                                                  def ZFSet.IsFunc (x y f : ZFSet.{u}) :

                                                                  isFunc x y f is the assertion that f is a subset of x × y which relates to each element of x a unique element of y, so that we can consider f as a ZFC function x → y.

                                                                  Equations
                                                                  Instances For

                                                                    funs x y is y ^ x, the set of all set functions x → y

                                                                    Equations
                                                                    Instances For
                                                                      @[simp]
                                                                      theorem ZFSet.mem_funs {x y f : ZFSet.{u}} :
                                                                      f ∈ x.funs y ↔ x.IsFunc y f
                                                                      @[instance_reducible]
                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.

                                                                      Graph of a function: map f x is the ZFC function which maps a ∈ x to f a

                                                                      Equations
                                                                      Instances For
                                                                        @[simp]
                                                                        theorem ZFSet.mem_map {f : ZFSet.{u_1} → ZFSet.{u_1}} [Definable₁ f] {x y : ZFSet.{u_1}} :
                                                                        y ∈ map f x ↔ ∃ z ∈ x, z.pair (f z) = y
                                                                        theorem ZFSet.map_unique {f : ZFSet.{u} → ZFSet.{u}} [Definable₁ f] {x z : ZFSet.{u}} (zx : z ∈ x) :
                                                                        @[simp]
                                                                        theorem ZFSet.map_isFunc {f : ZFSet.{u_1} → ZFSet.{u_1}} [Definable₁ f] {x y : ZFSet.{u_1}} :
                                                                        x.IsFunc y (map f x) ↔ ∀ z ∈ x, f z ∈ y
                                                                        @[irreducible]

                                                                        Given a predicate p on ZFC sets. Hereditarily p x means that x has property p and the members of x are all Hereditarily p.

                                                                        Equations
                                                                        Instances For
                                                                          theorem ZFSet.hereditarily_iff {p : ZFSet.{u} → Prop} {x : ZFSet.{u}} :
                                                                          Hereditarily p x ↔ p x ∧ ∀ y ∈ x, Hereditarily p y
                                                                          theorem ZFSet.Hereditarily.def {p : ZFSet.{u} → Prop} {x : ZFSet.{u}} :
                                                                          Hereditarily p x → p x ∧ ∀ y ∈ x, Hereditarily p y

                                                                          Alias of the forward direction of ZFSet.hereditarily_iff.

                                                                          theorem ZFSet.Hereditarily.self {p : ZFSet.{u} → Prop} {x : ZFSet.{u}} (h : Hereditarily p x) :
                                                                          p x
                                                                          theorem ZFSet.Hereditarily.mem {p : ZFSet.{u} → Prop} {x y : ZFSet.{u}} (h : Hereditarily p x) (hy : y ∈ x) :