@@ -153,6 +153,7 @@ noncomputable def allZFSetDefinable {n} (F : (Fin n → ZFSet.{u}) → ZFSet.{u}
153153end Classical
154154
155155namespace ZFSet
156+ variable {x y z : ZFSet.{u}}
156157
157158open PSet
158159
@@ -177,43 +178,55 @@ instance : Membership ZFSet ZFSet where
177178theorem mk_mem_iff {x y : PSet} : mk x ∈ mk y ↔ x ∈ y :=
178179 Iff.rfl
179180
181+ @[ext] lemma ext : (∀ z : ZFSet.{u}, z ∈ x ↔ z ∈ y) → x = y :=
182+ Quotient.inductionOn₂ x y fun _ _ h => Quotient.sound (Mem.ext fun w => h ⟦w⟧)
183+
184+ instance : SetLike ZFSet.{u} ZFSet.{u} where
185+ coe x := {y | y ∈ x}
186+ coe_injective' x y hxy := by ext z; exact congr(z ∈ $hxy)
187+
180188/-- Convert a ZFC set into a `Set` of ZFC sets -/
189+ @[deprecated SetLike.coe (since := "2025-11-05")]
181190def toSet (u : ZFSet.{u}) : Set ZFSet.{u} :=
182191 { x | x ∈ u }
183192
184- @[simp ]
185- theorem mem_toSet (a u : ZFSet.{u}) : a ∈ u.toSet ↔ a ∈ u :=
193+ @[deprecated SetLike.mem_coe (since := "2025-11-05") ]
194+ theorem mem_toSet (a u : ZFSet.{u}) : a ∈ (u : Set ZFSet.{u}) ↔ a ∈ u :=
186195 Iff.rfl
187196
188- instance small_toSet (x : ZFSet.{u}) : Small.{u} x.toSet :=
197+ instance small_coe (x : ZFSet.{u}) : Small.{u} x :=
189198 Quotient.inductionOn x fun a => by
190- let f : a.Type → ( mk a).toSet := fun i => ⟨mk <| a.Func i, func_mem a i⟩
199+ let f (i : a.Type ) : mk a := ⟨mk <| a.Func i, func_mem a i⟩
191200 suffices Function.Surjective f by exact small_of_surjective this
192201 rintro ⟨y, hb⟩
193202 induction y using Quotient.inductionOn
194203 obtain ⟨i, h⟩ := hb
195204 exact ⟨i, Subtype.coe_injective (Quotient.sound h.symm)⟩
196205
206+ @[deprecated (since := "2025-11-05")] alias small_toSet := small_coe
207+
197208/-- A nonempty set is one that contains some element. -/
198- protected def Nonempty (u : ZFSet) : Prop :=
199- u.toSet.Nonempty
209+ protected def Nonempty (u : ZFSet.{u}) : Prop := (u : Set ZFSet.{u}).Nonempty
200210
201211theorem nonempty_def (u : ZFSet) : u.Nonempty ↔ ∃ x, x ∈ u :=
202212 Iff.rfl
203213
204214theorem nonempty_of_mem {x u : ZFSet} (h : x ∈ u) : u.Nonempty :=
205215 ⟨x, h⟩
206216
207- @[simp]
208- theorem nonempty_toSet_iff {u : ZFSet} : u.toSet.Nonempty ↔ u.Nonempty :=
209- Iff.rfl
217+ @[simp, norm_cast] lemma nonempty_coe : (x : Set ZFSet.{u}).Nonempty ↔ x.Nonempty := .rfl
218+
219+ @[deprecated (since := "2025-11-05")] alias nonempty_toSet_iff := nonempty_coe
210220
211221/-- `x ⊆ y` as ZFC sets means that all members of `x` are members of `y`. -/
212222protected def Subset (x y : ZFSet.{u}) :=
213223 ∀ ⦃z⦄, z ∈ x → z ∈ y
214224
215- instance hasSubset : HasSubset ZFSet :=
216- ⟨ZFSet.Subset⟩
225+ instance : HasSubset ZFSet := ⟨ZFSet.Subset⟩
226+ instance : HasSSubset ZFSet := ⟨(· < ·)⟩
227+
228+ @[simp] lemma le_def : x ≤ y ↔ x ⊆ y := .rfl
229+ @[simp] lemma lt_def : x < y ↔ x ⊂ y := .rfl
217230
218231theorem subset_def {x y : ZFSet.{u}} : x ⊆ y ↔ ∀ ⦃z⦄, z ∈ x → z ∈ y :=
219232 Iff.rfl
@@ -232,33 +245,16 @@ theorem subset_iff : ∀ {x y : PSet}, mk x ⊆ mk y ↔ x ⊆ y
232245 let ⟨b, ab⟩ := h a
233246 ⟨b, za.trans ab⟩⟩
234247
235- @[simp]
236- theorem toSet_subset_iff {x y : ZFSet} : x.toSet ⊆ y.toSet ↔ x ⊆ y := by
237- simp [subset_def, Set.subset_def]
238-
239- @[ext]
240- theorem ext {x y : ZFSet.{u}} : (∀ z : ZFSet.{u}, z ∈ x ↔ z ∈ y) → x = y :=
241- Quotient.inductionOn₂ x y fun _ _ h => Quotient.sound (Mem.ext fun w => h ⟦w⟧)
242-
243- theorem toSet_injective : Function.Injective toSet := fun _ _ h => ext <| Set.ext_iff.1 h
244-
245- @[simp]
246- theorem toSet_inj {x y : ZFSet} : x.toSet = y.toSet ↔ x = y :=
247- toSet_injective.eq_iff
248-
249- instance : SetLike ZFSet ZFSet where
250- coe := toSet
251- coe_injective' := toSet_injective
248+ lemma coe_subset_coe : (x : Set ZFSet.{u}) ⊆ y ↔ x ⊆ y := by simp
252249
253- instance : HasSSubset ZFSet := ⟨(· < ·)⟩
250+ @[deprecated (since := "2025-11-05")] alias toSet_subset_iff := coe_subset_coe
254251
255- @[simp ]
256- theorem le_def (x y : ZFSet ) : x ≤ y ↔ x ⊆ y :=
257- Iff.rfl
252+ @[deprecated SetLike.coe_injective (since := "2025-11-05") ]
253+ theorem toSet_injective : Function.Injective ((↑ ) : ZFSet.{u} → Set ZFSet.{u}) :=
254+ SetLike.coe_injective
258255
259- @[simp]
260- theorem lt_def (x y : ZFSet) : x < y ↔ x ⊂ y :=
261- Iff.rfl
256+ @[deprecated SetLike.coe_set_eq (since := "2025-11-05")]
257+ lemma toSet_inj : (x : Set ZFSet.{u}) = y ↔ x = y := SetLike.coe_set_eq
262258
263259instance : IsAntisymm ZFSet (· ⊆ ·) :=
264260 ⟨@le_antisymm ZFSet _⟩
@@ -282,8 +278,9 @@ theorem notMem_empty (x) : x ∉ (∅ : ZFSet.{u}) :=
282278
283279@[deprecated (since := "2025-05-23")] alias not_mem_empty := notMem_empty
284280
285- @[simp]
286- theorem toSet_empty : toSet ∅ = ∅ := by simp [toSet]
281+ @[simp, norm_cast] lemma coe_empty : ((∅ : ZFSet.{u}) : Set ZFSet.{u}) = ∅ := by ext; simp
282+
283+ @[deprecated (since := "2025-11-05")] alias toSet_empty := coe_empty
287284
288285@[simp]
289286theorem empty_subset (x : ZFSet.{u}) : (∅ : ZFSet) ⊆ x :=
@@ -342,19 +339,22 @@ theorem mem_insert (x y : ZFSet) : x ∈ insert x y :=
342339theorem mem_insert_of_mem {y z : ZFSet} (x) (h : z ∈ y) : z ∈ insert x y :=
343340 mem_insert_iff.2 <| Or.inr h
344341
345- @[simp]
346- theorem toSet_insert (x y : ZFSet) : (insert x y).toSet = insert x y.toSet : = by
347- ext
348- simp
342+ @[simp, norm_cast ]
343+ lemma coe_insert (x y : ZFSet) : ↑ (insert x y) = ( insert x ↑y : Set ZFSet) : = by ext; simp
344+
345+ @[deprecated (since := "2025-11-05")] alias toSet_insert := coe_insert
349346
350347@[simp]
351- theorem mem_singleton {x y : ZFSet.{u}} : x ∈ @singleton ZFSet.{u} ZFSet.{u} _ y ↔ x = y :=
348+ theorem mem_singleton {x y : ZFSet.{u}} : x ∈ ({y} : ZFSet.{u}) ↔ x = y :=
352349 Quotient.inductionOn₂ x y fun _ _ => PSet.mem_singleton.trans eq.symm
353350
354- @[simp]
355- theorem toSet_singleton (x : ZFSet) : ({x} : ZFSet).toSet = {x} := by
356- ext
357- simp
351+ theorem notMem_singleton {x y : ZFSet.{u}} : x ∉ ({y} : ZFSet.{u}) ↔ x ≠ y :=
352+ mem_singleton.not
353+
354+ @[simp, norm_cast]
355+ lemma coe_singleton (x : ZFSet) : (({x} : ZFSet) : Set ZFSet) = {x} := by ext; simp
356+
357+ @[deprecated (since := "2025-11-05")] alias toSet_singleton := coe_singleton
358358
359359theorem insert_nonempty (u v : ZFSet) : (insert u v).Nonempty :=
360360 ⟨u, mem_insert u v⟩
@@ -425,12 +425,16 @@ theorem mem_sep {p : ZFSet.{u} → Prop} {x y : ZFSet.{u}} :
425425theorem sep_empty (p : ZFSet → Prop ) : (∅ : ZFSet).sep p = ∅ :=
426426 (eq_empty _).mpr fun _ h ↦ notMem_empty _ (mem_sep.mp h).1
427427
428- @[simp]
429- theorem toSet_sep (a : ZFSet) (p : ZFSet → Prop ) :
430- (ZFSet.sep p a).toSet = { x ∈ a.toSet | p x } := by
428+ theorem sep_subset {x p} : ZFSet.sep p x ⊆ x :=
429+ fun _ h => (mem_sep.1 h).1
430+
431+ @[simp, norm_cast]
432+ lemma coe_sep (a : ZFSet) (p : ZFSet → Prop ) : (ZFSet.sep p a : Set ZFSet) = {x ∈ a | p x} := by
431433 ext
432434 simp
433435
436+ @[deprecated (since := "2025-11-05")] alias toSet_sep := coe_sep
437+
434438/-- The powerset operation, the collection of subsets of a ZFC set -/
435439def powerset : ZFSet → ZFSet :=
436440 Quotient.map PSet.powerset
@@ -527,15 +531,20 @@ theorem sUnion_singleton {x : ZFSet.{u}} : ⋃₀ ({x} : ZFSet) = x :=
527531theorem sInter_singleton {x : ZFSet.{u}} : ⋂₀ ({x} : ZFSet) = x :=
528532 ext fun y => by simp_rw [mem_sInter (singleton_nonempty x), mem_singleton, forall_eq]
529533
530- @[simp]
531- theorem toSet_sUnion (x : ZFSet.{u}) : (⋃₀ x).toSet = ⋃₀ (toSet '' x.toSet ) := by
534+ @[simp, norm_cast ]
535+ lemma coe_sUnion (x : ZFSet.{u}) : (⋃₀ x : Set ZFSet) = ⋃₀ (SetLike.coe '' (x : Set ZFSet) ) := by
532536 ext
533537 simp
534538
535- theorem toSet_sInter {x : ZFSet.{u}} (h : x.Nonempty) : (⋂₀ x).toSet = ⋂₀ (toSet '' x.toSet) := by
539+ @[deprecated (since := "2025-11-05")] alias toSet_sUnion := coe_sUnion
540+
541+ @[simp, norm_cast]
542+ lemma coe_sInter (h : x.Nonempty) : (⋂₀ x : Set ZFSet) = ⋂₀ (SetLike.coe '' (x : Set ZFSet)) := by
536543 ext
537544 simp [mem_sInter h]
538545
546+ @[deprecated (since := "2025-11-05")] alias toSet_sInter := coe_sInter
547+
539548theorem singleton_injective : Function.Injective (@singleton ZFSet ZFSet _) := fun x y H => by
540549 let this := congr_arg sUnion H
541550 rwa [sUnion_singleton, sUnion_singleton] at this
@@ -565,39 +574,31 @@ instance : Inter ZFSet :=
565574instance : SDiff ZFSet :=
566575 ⟨ZFSet.diff⟩
567576
568- @[simp]
569- theorem toSet_union (x y : ZFSet.{u}) : (x ∪ y).toSet = x.toSet ∪ y.toSet := by
570- change (⋃₀ {x, y}).toSet = _
571- simp
577+ @[simp] lemma sUnion_pair (x y : ZFSet.{u}) : ⋃₀ ({x, y} : ZFSet.{u}) = x ∪ y := rfl
572578
573- @[simp]
574- theorem toSet_inter (x y : ZFSet.{u}) : (x ∩ y).toSet = x.toSet ∩ y.toSet := by
575- change (ZFSet.sep (fun z => z ∈ y) x).toSet = _
576- ext
577- simp
579+ @[simp] lemma sep_mem (x y : ZFSet.{u}) : x.sep (· ∈ y) = x ∩ y := rfl
580+ @[simp] lemma sep_notMem (x y : ZFSet.{u}) : x.sep (· ∉ y) = x \ y := rfl
578581
579- @[simp]
580- theorem toSet_sdiff (x y : ZFSet.{u}) : (x \ y).toSet = x.toSet \ y.toSet := by
581- change (ZFSet.sep (fun z => z ∉ y) x).toSet = _
582- ext
583- simp
582+ @[simp] lemma mem_union : z ∈ x ∪ y ↔ z ∈ x ∨ z ∈ y := by simp [← sUnion_pair]
583+ @[simp] lemma mem_inter : z ∈ x ∩ y ↔ z ∈ x ∧ z ∈ y := by simp [← sep_mem]
584+ @[simp] lemma mem_sdiff : z ∈ x \ y ↔ z ∈ x ∧ z ∉ y := by simp [← sep_notMem]
584585
585- @[simp]
586- theorem mem_union {x y z : ZFSet.{u}} : z ∈ x ∪ y ↔ z ∈ x ∨ z ∈ y := by
587- rw [← mem_toSet]
588- simp
586+ @[deprecated (since := "2025-11-06")] alias mem_diff := mem_sdiff
589587
590- @[simp]
591- theorem mem_inter {x y z : ZFSet.{u}} : z ∈ x ∩ y ↔ z ∈ x ∧ z ∈ y :=
592- @mem_sep (fun z : ZFSet.{u} => z ∈ y) x z
588+ @[simp, norm_cast]
589+ lemma coe_union (x y : ZFSet.{u}) : ↑(x ∪ y) = (↑x ∪ ↑y : Set ZFSet) := by ext; simp
593590
594- @[simp]
595- theorem mem_diff {x y z : ZFSet.{u}} : z ∈ x \ y ↔ z ∈ x ∧ z ∉ y :=
596- @mem_sep (fun z : ZFSet.{u} => z ∉ y) x z
591+ @[deprecated (since := "2025-11-05")] alias toSet_union := coe_union
597592
598- @[simp]
599- theorem sUnion_pair {x y : ZFSet.{u}} : ⋃₀ ({x, y} : ZFSet.{u}) = x ∪ y :=
600- rfl
593+ @[simp, norm_cast]
594+ lemma coe_inter (x y : ZFSet.{u}) : ↑(x ∩ y) = (↑x ∩ ↑y : Set ZFSet) := by ext; simp
595+
596+ @[deprecated (since := "2025-11-05")] alias toSet_inter := coe_inter
597+
598+ @[simp, norm_cast]
599+ lemma coe_sdiff (x y : ZFSet.{u}) : ↑(x \ y) = (↑x \ ↑y : Set ZFSet) := by ext; simp
600+
601+ @[deprecated (since := "2025-11-05")] alias toSet_sdiff := coe_sdiff
601602
602603theorem mem_wf : @WellFounded ZFSet (· ∈ ·) :=
603604 (wellFounded_lift₂_iff (H := fun a b c d hx hy =>
@@ -660,11 +661,11 @@ theorem mem_image {f : ZFSet.{u} → ZFSet.{u}} [Definable₁ f] {x y : ZFSet.{u
660661 ⟨fun ⟨a, ya⟩ => ⟨⟦A a⟧, Mem.mk A a, ((Quotient.sound ya).trans Definable₁.mk_out).symm⟩,
661662 fun ⟨_, hz, e⟩ => e ▸ image.mk _ _ hz⟩
662663
663- @[simp]
664- theorem toSet_image (f : ZFSet → ZFSet) [Definable₁ f] (x : ZFSet) :
665- (image f x).toSet = f '' x.toSet := by
666- ext
667- simp
664+ @[simp, norm_cast ]
665+ lemma coe_image (f : ZFSet → ZFSet) [Definable₁ f] (x : ZFSet) :
666+ (image f x : Set ZFSet) = f '' x := by ext; simp
667+
668+ @[deprecated (since := "2025-11-05")] alias toSet_image := coe_image
668669
669670section Small
670671
@@ -675,7 +676,7 @@ noncomputable def range (f : α → ZFSet.{u}) : ZFSet.{u} :=
675676 ⟦⟨_, Quotient.out ∘ f ∘ (equivShrink α).symm⟩⟧
676677
677678@[simp]
678- theorem mem_range {f : α → ZFSet.{u}} {x : ZFSet.{u}} : x ∈ range f ↔ x ∈ Set.range f :=
679+ theorem mem_range {f : α → ZFSet.{u}} {x : ZFSet.{u}} : x ∈ range f ↔ ∃ i, f i = x :=
679680 Quotient.inductionOn x fun y => by
680681 constructor
681682 · rintro ⟨z, hz⟩
@@ -684,10 +685,10 @@ theorem mem_range {f : α → ZFSet.{u}} {x : ZFSet.{u}} : x ∈ range f ↔ x
684685 use equivShrink α z
685686 simpa [hz] using PSet.Equiv.symm (Quotient.mk_out y)
686687
687- @[simp]
688- theorem toSet_range (f : α → ZFSet.{u}) : (range f).toSet = Set .range f := by
689- ext
690- simp
688+ @[simp, norm_cast ]
689+ lemma coe_range (f : α → ZFSet.{u}) : (range f : Set ZFSet) = .range f := by ext; simp
690+
691+ @[deprecated (since := "2025-11-05")] alias toSet_range := coe_range
691692
692693theorem mem_range_self {f : α → ZFSet.{u}} (a : α) : f a ∈ range f := by simp
693694
@@ -701,11 +702,13 @@ noncomputable def iUnion (f : α → ZFSet.{u}) : ZFSet.{u} :=
701702theorem mem_iUnion {f : α → ZFSet.{u}} {x : ZFSet.{u}} : x ∈ ⋃ i, f i ↔ ∃ i, x ∈ f i := by
702703 simp [iUnion]
703704
704- @[simp]
705- theorem toSet_iUnion (f : α → ZFSet.{u}) : (⋃ i, f i).toSet = ⋃ i, (f i).toSet := by
705+ @[simp, norm_cast ]
706+ lemma coe_iUnion (f : α → ZFSet.{u}) : ↑ (⋃ i, f i) = ⋃ i, (f i : Set ZFSet) := by
706707 ext
707708 simp
708709
710+ @[deprecated (since := "2025-11-05")] alias toSet_iUnion := coe_iUnion
711+
709712theorem subset_iUnion (f : α → ZFSet.{u}) (i : α) : f i ⊆ ⋃ i, f i := by
710713 intro x hx
711714 simpa using ⟨i, hx⟩
@@ -716,8 +719,10 @@ end Small
716719def pair (x y : ZFSet.{u}) : ZFSet.{u} :=
717720 {{x}, {x, y}}
718721
719- @[simp]
720- theorem toSet_pair (x y : ZFSet.{u}) : (pair x y).toSet = {{x}, {x, y}} := by simp [pair]
722+ @[simp, norm_cast]
723+ lemma coe_pair (x y : ZFSet.{u}) : (pair x y : Set ZFSet) = {{x}, {x, y}} := by simp [pair]
724+
725+ @[deprecated (since := "2025-11-05")] alias toSet_pair := coe_pair
721726
722727/-- A subset of pairs `{(a, b) ∈ x × y | p a b}` -/
723728def pairSep (p : ZFSet.{u} → ZFSet.{u} → Prop ) (x y : ZFSet.{u}) : ZFSet.{u} :=
0 commit comments