Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit ef5f2ce

Browse files
committed
feat(set_theory/zfc/basic): simpler/more general Class.ext (#18306)
I failed to notice `set.ext` was simpler and more general than my custom `Class.ext` lemma. As such, I've replaced it.
1 parent b31173e commit ef5f2ce

File tree

1 file changed

+14
-21
lines changed

1 file changed

+14
-21
lines changed

src/set_theory/zfc/basic.lean

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,10 @@ def Class := set Set
921921

922922
namespace Class
923923

924+
@[ext] theorem ext {x y : Class.{u}} : (∀ z : Set.{u}, x z ↔ y z) → x = y := set.ext
925+
926+
theorem ext_iff {x y : Class.{u}} : x = y ↔ ∀ z, x z ↔ y z := set.ext_iff
927+
924928
/-- Coerce a ZFC set into a class -/
925929
def of_Set (x : Set.{u}) : Class.{u} := {y | y ∈ x}
926930
instance : has_coe Set Class := ⟨of_Set⟩
@@ -1007,26 +1011,26 @@ to_Set_of_Set _ _
10071011

10081012
@[simp, norm_cast] theorem coe_sep (p : Class.{u}) (x : Set.{u}) :
10091013
(↑{y ∈ x | p y} : Class.{u}) = {y ∈ x | p y} :=
1010-
set.ext $ λ y, Set.mem_sep
1014+
ext $ λ y, Set.mem_sep
10111015

10121016
@[simp, norm_cast] theorem coe_empty : ↑(∅ : Set.{u}) = (∅ : Class.{u}) :=
1013-
set.ext $ λ y, (iff_false _).2 $ Set.not_mem_empty y
1017+
ext $ λ y, (iff_false _).2 $ Set.not_mem_empty y
10141018

10151019
@[simp, norm_cast] theorem coe_insert (x y : Set.{u}) :
10161020
↑(insert x y) = @insert Set.{u} Class.{u} _ x y :=
1017-
set.ext $ λ z, Set.mem_insert_iff
1021+
ext $ λ z, Set.mem_insert_iff
10181022

10191023
@[simp, norm_cast] theorem coe_union (x y : Set.{u}) : ↑(x ∪ y) = (x : Class.{u}) ∪ y :=
1020-
set.ext $ λ z, Set.mem_union
1024+
ext $ λ z, Set.mem_union
10211025

10221026
@[simp, norm_cast] theorem coe_inter (x y : Set.{u}) : ↑(x ∩ y) = (x : Class.{u}) ∩ y :=
1023-
set.ext $ λ z, Set.mem_inter
1027+
ext $ λ z, Set.mem_inter
10241028

10251029
@[simp, norm_cast] theorem coe_diff (x y : Set.{u}) : ↑(x \ y) = (x : Class.{u}) \ y :=
1026-
set.ext $ λ z, Set.mem_diff
1030+
ext $ λ z, Set.mem_diff
10271031

10281032
@[simp, norm_cast] theorem coe_powerset (x : Set.{u}) : ↑x.powerset = powerset.{u} x :=
1029-
set.ext $ λ z, Set.mem_powerset
1033+
ext $ λ z, Set.mem_powerset
10301034

10311035
@[simp] theorem powerset_apply {A : Class.{u}} {x : Set.{u}} : powerset A x ↔ ↑x ⊆ A := iff.rfl
10321036

@@ -1039,18 +1043,7 @@ begin
10391043
end
10401044

10411045
@[simp, norm_cast] theorem coe_sUnion (x : Set.{u}) : ↑(⋃₀ x) = ⋃₀ (x : Class.{u}) :=
1042-
set.ext $ λ y, Set.mem_sUnion.trans (sUnion_apply.trans $ by simp_rw [coe_apply, exists_prop]).symm
1043-
1044-
@[ext] theorem ext {x y : Class.{u}} : (∀ z : Class.{u}, z ∈ x ↔ z ∈ y) → x = y :=
1045-
begin
1046-
refine λ h, set.ext (λ z, _),
1047-
change x z ↔ y z,
1048-
rw [←@coe_mem z x, ←@coe_mem z y],
1049-
exact h z
1050-
end
1051-
1052-
theorem ext_iff {x y : Class.{u}} : x = y ↔ (∀ z : Class.{u}, z ∈ x ↔ z ∈ y) :=
1053-
⟨λ h, by simp [h], ext⟩
1046+
ext $ λ y, Set.mem_sUnion.trans (sUnion_apply.trans $ by simp_rw [coe_apply, exists_prop]).symm
10541047

10551048
@[simp] theorem mem_sUnion {x y : Class.{u}} : y ∈ ⋃₀ x ↔ ∃ z, z ∈ x ∧ y ∈ z :=
10561049
begin
@@ -1077,7 +1070,7 @@ end
10771070
def iota (A : Class) : Class := ⋃₀ {x | ∀ y, A y ↔ y = x}
10781071

10791072
theorem iota_val (A : Class) (x : Set) (H : ∀ y, A y ↔ y = x) : iota A = ↑x :=
1080-
set.ext $ λ y, ⟨λ ⟨._, ⟨x', rfl, h⟩, yx'⟩, by rwa ←((H x').1 $ (h x').2 rfl),
1073+
ext $ λ y, ⟨λ ⟨._, ⟨x', rfl, h⟩, yx'⟩, by rwa ←((H x').1 $ (h x').2 rfl),
10811074
λ yx, ⟨_, ⟨x, rfl, H⟩, yx⟩⟩
10821075

10831076
/-- Unlike the other set constructors, the `iota` definite descriptor
@@ -1086,7 +1079,7 @@ set.ext $ λ y, ⟨λ ⟨._, ⟨x', rfl, h⟩, yx'⟩, by rwa ←((H x').1 $ (h
10861079
theorem iota_ex (A) : iota.{u} A ∈ univ.{u} :=
10871080
mem_univ.2 $ or.elim (classical.em $ ∃ x, ∀ y, A y ↔ y = x)
10881081
(λ ⟨x, h⟩, ⟨x, eq.symm $ iota_val A x h⟩)
1089-
(λ hn, ⟨∅, set.ext (λ z, coe_empty.symm ▸ ⟨false.rec _, λ ⟨._, ⟨x, rfl, H⟩, zA⟩, hn ⟨x, H⟩⟩)⟩)
1082+
(λ hn, ⟨∅, ext (λ z, coe_empty.symm ▸ ⟨false.rec _, λ ⟨._, ⟨x, rfl, H⟩, zA⟩, hn ⟨x, H⟩⟩)⟩)
10901083

10911084
/-- Function value -/
10921085
def fval (F A : Class.{u}) : Class.{u} := iota (λ y, to_Set (λ x, F (Set.pair x y)) A)

0 commit comments

Comments
 (0)