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

Turns a pre-set into a ZFC set.

Equations
@[simp]
theorem ZFSet.mk_eq (x : PSet.{u_1}) :
@[simp]
class ZFSet.Definable (n : ) (f : (Fin nZFSet.{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
    @[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
    @[reducible, inline]

    Turns a unary definable function into a unary PSet function.

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

    An abbrev of ZFSet.Definable for binary functions.

    Equations
    @[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
    @[reducible, inline]

    Turns a binary definable function into a binary PSet function.

    Equations
    instance ZFSet.instDefinableOfDefinable₁ (f : ZFSet.{u_1}ZFSet.{u_1}) [Definable₁ f] (n : ) (g : (Fin nZFSet.{u_1})ZFSet.{u_1}) [Definable n g] :
    Definable n fun (s : Fin nZFSet.{u_1}) => f (g s)
    Equations
    instance ZFSet.instDefinableOfDefinable₂ (f : ZFSet.{u_1}ZFSet.{u_1}ZFSet.{u_1}) [Definable₂ f] (n : ) (g₁ g₂ : (Fin nZFSet.{u_1})ZFSet.{u_1}) [Definable n g₁] [Definable n g₂] :
    Definable n fun (s : Fin nZFSet.{u_1}) => f (g₁ s) (g₂ s)
    Equations
    instance ZFSet.instDefinable (n : ) (i : Fin n) :
    Definable n fun (s : Fin nZFSet.{u_1}) => s i
    Equations
    theorem ZFSet.Definable.out_equiv {n : } (f : (Fin nZFSet.{u})ZFSet.{u}) [Definable n f] {xs ys : Fin nPSet.{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₂
    noncomputable def Classical.allZFSetDefinable {n : } (F : (Fin nZFSet.{u})ZFSet.{u}) :

    All functions are classically definable.

    Equations
    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 yx.Equiv y

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

    Equations
    @[simp]
    theorem ZFSet.mk_mem_iff {x y : PSet.{u_1}} :
    mk x mk y x y

    Convert a ZFC set into a Set of ZFC sets

    Equations
    @[simp]
    theorem ZFSet.mem_toSet (a u : ZFSet.{u}) :
    a u.toSet a u

    A nonempty set is one that contains some element.

    Equations

    x ⊆ y as ZFC sets means that all members of x are members of y.

    Equations
    theorem ZFSet.subset_def {x y : ZFSet.{u}} :
    x y ∀ ⦃z : ZFSet.{u}⦄, z xz y
    @[simp]
    theorem ZFSet.subset_iff {x y : PSet.{u_1}} :
    mk x mk y x y
    @[simp]
    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
    @[simp]
    theorem ZFSet.toSet_inj {x y : ZFSet.{u_1}} :
    x.toSet = y.toSet x = y
    Equations
    @[simp]
    theorem ZFSet.le_def (x y : ZFSet.{u_1}) :
    x y x y
    @[simp]
    theorem ZFSet.lt_def (x y : ZFSet.{u_1}) :
    x < y x y

    The empty ZFC set

    Equations
    @[simp]
    theorem ZFSet.notMem_empty (x : ZFSet.{u}) :
    x
    @[deprecated ZFSet.notMem_empty (since := "2025-05-23")]
    theorem ZFSet.not_mem_empty (x : ZFSet.{u}) :
    x

    Alias of ZFSet.notMem_empty.

    @[simp]
    theorem ZFSet.eq_empty (x : ZFSet.{u}) :
    x = ∀ (y : ZFSet.{u}), yx
    @[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]
    @[simp]
    theorem ZFSet.mem_singleton {x y : ZFSet.{u}} :
    x {y} x = y
    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
    @[simp]

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

    Equations
    @[simp]
    theorem ZFSet.mem_sep {p : ZFSet.{u}Prop} {x y : ZFSet.{u}} :
    y ZFSet.sep p x y x p y
    @[simp]
    @[simp]

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

    Equations
    @[simp]
    theorem ZFSet.mem_powerset {x y : ZFSet.{u}} :
    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

    Equations

    The union operator, the collection of elements of elements of a ZFC set

    Equations

    The intersection operator, the collection of elements in all of the elements of a ZFC set. We define ⋂₀ ∅ = ∅.

    Equations

    The intersection operator, the collection of elements in all of the elements of a ZFC set. We define ⋂₀ ∅ = ∅.

    Equations
    @[simp]
    theorem ZFSet.mem_sUnion {x y : ZFSet.{u}} :
    y ⋃₀ x zx, y z
    theorem ZFSet.mem_sInter {x y : ZFSet.{u_1}} (h : x.Nonempty) :
    y ⋂₀ x zx, y z
    theorem ZFSet.mem_of_mem_sInter {x y z : ZFSet.{u_1}} (hy : y ⋂₀ x) (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 : yz) (hz : z x) :
    y⋂₀ x
    @[deprecated ZFSet.notMem_sInter_of_notMem (since := "2025-05-23")]
    theorem ZFSet.not_mem_sInter_of_not_mem {x y z : ZFSet.{u_1}} (hy : yz) (hz : z x) :
    y⋂₀ x

    Alias of ZFSet.notMem_sInter_of_notMem.

    @[simp]
    theorem ZFSet.singleton_inj {x y : ZFSet.{u_1}} :
    {x} = {y} x = y

    The binary union operation

    Equations

    The binary intersection operation

    Equations

    The set difference operation

    Equations
    @[simp]
    theorem ZFSet.toSet_union (x y : ZFSet.{u}) :
    (x y).toSet = x.toSet y.toSet
    @[simp]
    theorem ZFSet.toSet_inter (x y : ZFSet.{u}) :
    (x y).toSet = x.toSet y.toSet
    @[simp]
    theorem ZFSet.toSet_sdiff (x y : ZFSet.{u}) :
    (x \ y).toSet = x.toSet \ y.toSet
    @[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_diff {x y z : ZFSet.{u}} :
    z x \ y z x zy
    @[simp]
    theorem ZFSet.sUnion_pair {x y : ZFSet.{u}} :
    ⋃₀ {x, y} = x y
    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}), (∀ yx, p y)p x) :
    p x

    Induction on the relation.

    theorem ZFSet.mem_asymm {x y : ZFSet.{u_1}} :
    x yyx
    theorem ZFSet.mem_irrefl (x : ZFSet.{u_1}) :
    xx
    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) :
    yx
    @[deprecated ZFSet.notMem_of_subset (since := "2025-05-23")]
    theorem ZFSet.not_mem_of_subset {x y : ZFSet.{u_1}} (h : x y) :
    yx

    Alias of ZFSet.notMem_of_subset.

    theorem ZFSet.regularity (x : ZFSet.{u}) (h : x ) :
    yx, x y =

    The image of a (definable) ZFC set function

    Equations
    theorem ZFSet.image.mk (f : ZFSet.{u}ZFSet.{u}) [Definable₁ f] (x : ZFSet.{u}) {y : ZFSet.{u}} :
    y xf y image f x
    @[simp]
    theorem ZFSet.mem_image {f : ZFSet.{u}ZFSet.{u}} [Definable₁ f] {x y : ZFSet.{u}} :
    y image f x zx, f z = y
    noncomputable def ZFSet.range {α : Type u_1} [Small.{u, u_1} α] (f : αZFSet.{u}) :

    The range of a type-indexed family of sets.

    Equations
    @[simp]
    theorem ZFSet.mem_range {α : Type u_1} [Small.{u, u_1} α] {f : αZFSet.{u}} {x : ZFSet.{u}} :
    @[simp]
    theorem ZFSet.toSet_range {α : Type u_1} [Small.{u, u_1} α] (f : αZFSet.{u}) :

    Kuratowski ordered pair

    Equations
    @[simp]
    theorem ZFSet.toSet_pair (x y : ZFSet.{u}) :
    (x.pair y).toSet = {{x}, {x, y}}

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

    Equations
    @[simp]
    theorem ZFSet.mem_pairSep {p : ZFSet.{u}ZFSet.{u}Prop} {x y z : ZFSet.{u}} :
    z pairSep p x y ax, by, 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
    @[simp]
    theorem ZFSet.mem_prod {x y z : ZFSet.{u}} :
    z x.prod y ax, by, 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

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

    Equations
    @[simp]
    theorem ZFSet.mem_funs {x y f : ZFSet.{u}} :
    f x.funs y x.IsFunc y f

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

    Equations
    @[simp]
    theorem ZFSet.mem_map {f : ZFSet.{u_1}ZFSet.{u_1}} [Definable₁ f] {x y : ZFSet.{u_1}} :
    y map f x zx, 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) zx, 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
    theorem ZFSet.hereditarily_iff {p : ZFSet.{u}Prop} {x : ZFSet.{u}} :
    Hereditarily p x p x yx, Hereditarily p y
    theorem ZFSet.Hereditarily.def {p : ZFSet.{u}Prop} {x : ZFSet.{u}} :
    Hereditarily p xp x yx, 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) :