-- Grothendieck universes and their closure under the set-forming operations -- Part of Cumulus, the Grace17 mathematics library. -- Copyright (c) 2026 Grant Passmore. -- Released under the Apache License 2.0. See LICENSE in the repository root. -- Authors: Grant Passmore module Grace.Cumulus.LargeCardinal.Universe import Set.Function.Space import Set.Ordinal.Basic import Set.Function -- A Grothendieck universe is a transitive set containing ω and closed under -- pairs, power sets, and unions of families indexed by its members: for -- I ∈ U and a function f : I → U, the union of the values of f lies in U. -- Requiring ω ∈ U excludes the degenerate universes ∅ and V(ω). predicate GrothendieckUniverse (U : Set) := Transitive(U) ∧ ω ∈ U ∧ (∀ x ∈ U, ∀ y ∈ U, {x, y} ∈ U) ∧ (∀ x ∈ U, 𝒫(x) ∈ U) ∧ (∀ I ∈ U, ∀ f, FunctionBetween(f, I, U) → ⋃(functionImage(f, I, U)) ∈ U) register largecardinal GrothendieckUniverse "a Grothendieck universe" theorem GrothendieckUniverse.transitive (U : Set) requires universe : GrothendieckUniverse(U) shows Transitive(U) proof simp [GrothendieckUniverse] theorem GrothendieckUniverse.omega (U : Set) requires universe : GrothendieckUniverse(U) shows ω ∈ U proof simp [GrothendieckUniverse] theorem GrothendieckUniverse.pair (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U requires hy : y ∈ U shows {x, y} ∈ U proof obtain ⟨_, _, pairs, _, _⟩ := universe exact pairs with x, hx, y, hy theorem GrothendieckUniverse.powerset (U x : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U shows 𝒫(x) ∈ U proof obtain ⟨_, _, _, powersets, _⟩ := universe exact powersets with x, hx theorem GrothendieckUniverse.indexed_union (U I f : Set) requires universe : GrothendieckUniverse(U) requires hI : I ∈ U requires function : f : I → U shows ⋃(functionImage(f, I, U)) ∈ U proof obtain ⟨_, _, _, _, unions⟩ := universe exact unions with I, hI, f, function theorem GrothendieckUniverse.member_subset (U x : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U shows x ⊆ U proof have transitive := GrothendieckUniverse.transitive with universe exact transitive with x, hx theorem GrothendieckUniverse.member_of_member (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U requires hy : y ∈ x shows y ∈ U proof have included := GrothendieckUniverse.member_subset with universe, hx exact included with y, hy theorem GrothendieckUniverse.subset (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U requires hy : y ⊆ x shows y ∈ U proof have powerset := GrothendieckUniverse.powerset with universe, hx have inPowerset := set.powerset.backward with hy exact GrothendieckUniverse.member_of_member with universe, powerset, inPowerset theorem GrothendieckUniverse.empty (U : Set) requires universe : GrothendieckUniverse(U) shows ∅ ∈ U proof have omega := GrothendieckUniverse.omega with universe exact GrothendieckUniverse.subset with universe, omega, (empty.subset at ω) theorem GrothendieckUniverse.singleton (U x : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U shows {x} ∈ U proof have doubled := GrothendieckUniverse.pair with universe, hx, hx rwa pair.self at doubled theorem GrothendieckUniverse.orderedPair (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U requires hy : y ∈ U shows (x, y) ∈ U proof unfold orderedPair have first := GrothendieckUniverse.pair with universe, hx, hx have second := GrothendieckUniverse.pair with universe, hx, hy exact GrothendieckUniverse.pair with universe, first, second theorem GrothendieckUniverse.union (U x : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U shows ⋃(x) ∈ U proof have included := GrothendieckUniverse.member_subset with universe, hx have function := identity.inclusion with included have unions := GrothendieckUniverse.indexed_union with universe, hx, function rwa functionImage.identity with included at unions theorem GrothendieckUniverse.union2 (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U requires hy : y ∈ U shows x ∪ y ∈ U proof have pair := GrothendieckUniverse.pair with universe, hx, hy have unions := GrothendieckUniverse.union with universe, pair rwa union.pair at unions theorem GrothendieckUniverse.intersection (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U shows x ∩ y ∈ U proof exact GrothendieckUniverse.subset with universe, hx, (intersection.subset_left at x, y) theorem GrothendieckUniverse.difference (U x y : Set) requires universe : GrothendieckUniverse(U) requires hx : x ∈ U shows x ∖ y ∈ U proof exact GrothendieckUniverse.subset with universe, hx, (difference.subset_left at x, y) theorem GrothendieckUniverse.product (U A B : Set) requires universe : GrothendieckUniverse(U) requires hA : A ∈ U requires hB : B ∈ U shows A × B ∈ U proof have joined := GrothendieckUniverse.union2 with universe, hA, hB have once := GrothendieckUniverse.powerset with universe, joined have twice := GrothendieckUniverse.powerset with universe, once have bounded : A × B ⊆ productBound(A, B) by simp [product] unfold productBound at bounded exact GrothendieckUniverse.subset with universe, twice, bounded theorem GrothendieckUniverse.functionSpace (U A B : Set) requires universe : GrothendieckUniverse(U) requires hA : A ∈ U requires hB : B ∈ U shows functionSpace(A, B) ∈ U proof have product := GrothendieckUniverse.product with universe, hA, hB have powerset := GrothendieckUniverse.powerset with universe, product exact GrothendieckUniverse.subset with universe, powerset, (functionSpace.subset_powerset at A, B) -- The image of a member under a function into the universe is a member: -- every value is a subset of the union of the values. theorem GrothendieckUniverse.functionImage (U I f : Set) requires universe : GrothendieckUniverse(U) requires hI : I ∈ U requires function : f : I → U shows functionImage(f, I, U) ∈ U proof have unions := GrothendieckUniverse.indexed_union with universe, hI, function have powerset := GrothendieckUniverse.powerset with universe, unions have bounded : functionImage(f, I, U) ⊆ 𝒫(⋃(functionImage(f, I, U))) . intros y hy exact set.powerset.backward with (union.subset_of_member with hy) exact GrothendieckUniverse.subset with universe, powerset, bounded theorem GrothendieckUniverse.range (U I f : Set) requires universe : GrothendieckUniverse(U) requires hI : I ∈ U requires function : f : I → U shows range(f) ∈ U proof have image := GrothendieckUniverse.functionImage with universe, hI, function have bounded : range(f) ⊆ functionImage(f, I, U) . intros y hy obtain ⟨_, x, mapped⟩ := range.membership.forward with hy obtain ⟨hx, value⟩ := FunctionBetween.bounds with function, mapped have applied := FunctionBetween.apply_value with function, hx, mapped have same : y = f(x) by rw applied exact functionImage.membership.backward with ⟨value, x, hx, same⟩ exact GrothendieckUniverse.subset with universe, image, bounded -- A function from a member into the universe is itself a member. theorem GrothendieckUniverse.function (U I f : Set) requires universe : GrothendieckUniverse(U) requires hI : I ∈ U requires function : f : I → U shows f ∈ U proof have image := GrothendieckUniverse.functionImage with universe, hI, function have product := GrothendieckUniverse.product with universe, hI, image have corestricted := functionImage.corestrict with function have relation := FunctionBetween.relation with corestricted exact GrothendieckUniverse.subset with universe, product, relation theorem GrothendieckUniverse.omega_subset (U : Set) requires universe : GrothendieckUniverse(U) shows ω ⊆ U proof exact GrothendieckUniverse.member_subset with universe, (GrothendieckUniverse.omega with universe) theorem GrothendieckUniverse.natural (U : Set, n : Nat) requires universe : GrothendieckUniverse(U) shows n ∈ U proof have omega := GrothendieckUniverse.omega with universe have inOmega : n ∈ ω by simp [nat.omega] exact GrothendieckUniverse.member_of_member with universe, omega, inOmega theorem GrothendieckUniverse.next (U α : Set) requires universe : GrothendieckUniverse(U) requires hα : α ∈ U shows next(α) ∈ U proof unfold next exact GrothendieckUniverse.union2 with universe, hα, (GrothendieckUniverse.singleton with universe, hα) -- The ordinals of a universe form an ordinal: a limit ordinal above ω. theorem GrothendieckUniverse.ordinalsWithin (U : Set) requires universe : GrothendieckUniverse(U) shows ordinalsWithin(U) ∈ Ordinal proof have transitive : Transitive(ordinalsWithin(U)) intros α hα simp [ordinalsWithin.membership] at hα intros β hβ have ordinal := Ordinal.member with hα.right, hβ have member := GrothendieckUniverse.member_of_member with universe, hα.left, hβ simp [ordinalsWithin.membership] simp [Ordinal] theorem GrothendieckUniverse.ordinalsWithin_next (U α : Set) requires universe : GrothendieckUniverse(U) requires hα : α ∈ ordinalsWithin(U) shows next(α) ∈ ordinalsWithin(U) proof obtain ⟨member, ordinal⟩ := ordinalsWithin.membership.forward with hα have nextMember := GrothendieckUniverse.next with universe, member have nextOrdinal := Ordinal.next with ordinal exact ordinalsWithin.membership.backward with ⟨nextMember, nextOrdinal⟩ theorem GrothendieckUniverse.omega_ordinalsWithin (U : Set) requires universe : GrothendieckUniverse(U) shows ω ∈ ordinalsWithin(U) proof have omega := GrothendieckUniverse.omega with universe exact ordinalsWithin.membership.backward with ⟨omega, Ordinal.omega⟩ theorem GrothendieckUniverse.ordinalsWithin_limit (U : Set) requires universe : GrothendieckUniverse(U) shows Limit(ordinalsWithin(U)) proof have ordinal := GrothendieckUniverse.ordinalsWithin with universe have omega := GrothendieckUniverse.omega_ordinalsWithin with universe refine ⟨ordinal, ?_, ?_⟩ . intro empty rw empty at omega exact set.empty with omega . intros α hα exact GrothendieckUniverse.ordinalsWithin_next with universe, hα theorem GrothendieckUniverse.ordinalsWithin_not_member (U : Set) requires universe : GrothendieckUniverse(U) shows ¬(ordinalsWithin(U) ∈ U) proof intro member have ordinal := GrothendieckUniverse.ordinalsWithin with universe have self := ordinalsWithin.membership.backward at U, ordinalsWithin(U) with ⟨member, ordinal⟩ exact Ordinal.not_member_self with self