Skip to content

Commit f508a8e

Browse files
committed
feat(SetTheory/ZFC/Basic): order instances (#19946)
Sets form a partial order under the subset relation.
1 parent bb737a6 commit f508a8e

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

Mathlib/SetTheory/ZFC/Basic.lean

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Mario Carneiro
55
-/
66
import Mathlib.Data.Fin.VecNotation
7+
import Mathlib.Data.SetLike.Basic
78
import Mathlib.Logic.Small.Basic
89
import Mathlib.SetTheory.ZFC.PSet
910

@@ -241,8 +242,25 @@ theorem toSet_injective : Function.Injective toSet := fun _ _ h => ext <| Set.ex
241242
theorem toSet_inj {x y : ZFSet} : x.toSet = y.toSet ↔ x = y :=
242243
toSet_injective.eq_iff
243244

245+
instance : SetLike ZFSet ZFSet where
246+
coe := toSet
247+
coe_injective' := toSet_injective
248+
249+
instance : HasSSubset ZFSet := ⟨(· < ·)⟩
250+
251+
@[simp]
252+
theorem le_def (x y : ZFSet) : x ≤ y ↔ x ⊆ y :=
253+
Iff.rfl
254+
255+
@[simp]
256+
theorem lt_def (x y : ZFSet) : x < y ↔ x ⊂ y :=
257+
Iff.rfl
258+
244259
instance : IsAntisymm ZFSet (· ⊆ ·) :=
245-
fun _ _ hab hba => ext fun c => ⟨@hab c, @hba c⟩⟩
260+
⟨@le_antisymm ZFSet _⟩
261+
262+
instance : IsNonstrictStrictOrder ZFSet (· ⊆ ·) (· ⊂ ·) :=
263+
fun _ _ ↦ Iff.rfl⟩
246264

247265
/-- The empty ZFC set -/
248266
protected def empty : ZFSet :=

Mathlib/SetTheory/ZFC/Class.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ theorem eq_univ_of_powerset_subset {A : Class} (hA : powerset A ⊆ A) : A = uni
276276

277277
/-- The definite description operator, which is `{x}` if `{y | A y} = {x}` and `∅` otherwise. -/
278278
def iota (A : Class) : Class :=
279-
⋃₀ { x | ∀ y, A y ↔ y = x }
279+
⋃₀ ({ x | ∀ y, A y ↔ y = x } : Class)
280280

281281
theorem iota_val (A : Class) (x : ZFSet) (H : ∀ y, A y ↔ y = x) : iota A = ↑x :=
282282
ext fun y =>

Mathlib/SetTheory/ZFC/PSet.lean

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,24 @@ theorem Subset.congr_right : ∀ {x y z : PSet}, Equiv x y → (z ⊆ x ↔ z
158158
let ⟨a, ab⟩ := βα b
159159
⟨a, cb.trans (Equiv.symm ab)⟩⟩
160160

161+
instance : Preorder PSet where
162+
le := (· ⊆ ·)
163+
le_refl := refl_of (· ⊆ ·)
164+
le_trans _ _ _ := trans_of (· ⊆ ·)
165+
166+
instance : HasSSubset PSet := ⟨(· < ·)⟩
167+
168+
@[simp]
169+
theorem le_def (x y : PSet) : x ≤ y ↔ x ⊆ y :=
170+
Iff.rfl
171+
172+
@[simp]
173+
theorem lt_def (x y : PSet) : x < y ↔ x ⊂ y :=
174+
Iff.rfl
175+
176+
instance : IsNonstrictStrictOrder PSet (· ⊆ ·) (· ⊂ ·) :=
177+
fun _ _ ↦ Iff.rfl⟩
178+
161179
/-- `x ∈ y` as pre-sets if `x` is extensionally equivalent to a member of the family `y`. -/
162180
protected def Mem (y x : PSet.{u}) : Prop :=
163181
∃ b, Equiv x (y.Func b)

0 commit comments

Comments
 (0)