@@ -75,8 +75,24 @@ namespace Set
7575
7676variable {α : Type u} {β : Type v} {γ : Type w}
7777
78+ /-! ### Lemmas about `mem` and `setOf` -/
79+
80+ theorem mem_setOf {a : α} {p : α → Prop } : a ∈ { x | p x } ↔ p a :=
81+ Iff.rfl
82+
83+ /-- This lemma is intended for use with `rw` where a membership predicate is needed,
84+ hence the explicit argument and the equality in the reverse direction from normal.
85+ See also `Set.mem_setOf_eq` for the reverse direction applied to an argument. -/
86+ theorem eq_mem_setOf (p : α → Prop ) : p = (· ∈ {a | p a}) := rfl
87+
88+ /-- If `h : a ∈ {x | p x}` then `h.out : p x`. These are definitionally equal, but this can
89+ nevertheless be useful for various reasons, e.g. to apply further projection notation or in an
90+ argument to `simp`. -/
91+ theorem _root_.Membership.mem.out {p : α → Prop } {a : α} (h : a ∈ { x | p x }) : p a :=
92+ h
93+
7894-- TODO(Jeremy): write a tactic to unfold specific instances of generic notation?
79- theorem subset_def {s t : Set α}: (s ⊆ t) = ∀ x, x ∈ s → x ∈ t := rfl
95+ theorem subset_def {s t : Set α} : (s ⊆ t) = ∀ x, x ∈ s → x ∈ t := rfl
8096
8197@ [simp, mfld_simps] theorem mem_univ (x : α) : x ∈ @univ α := trivial
8298
@@ -106,6 +122,18 @@ theorem subset_setOf {p : α → Prop} {s : Set α} : s ⊆ setOf p ↔ ∀ x, x
106122theorem setOf_subset {p : α → Prop } {s : Set α} : setOf p ⊆ s ↔ ∀ x, p x → x ∈ s :=
107123 Iff.rfl
108124
125+ @[simp]
126+ theorem setOf_subset_setOf {p q : α → Prop } : { a | p a } ⊆ { a | q a } ↔ ∀ a, p a → q a :=
127+ Iff.rfl
128+
129+ theorem setOf_and {p q : α → Prop } : { a | p a ∧ q a } = { a | p a } ∩ { a | q a } :=
130+ rfl
131+
132+ theorem setOf_or {p q : α → Prop } : { a | p a ∨ q a } = { a | p a } ∪ { a | q a } :=
133+ rfl
134+
135+ /-! ### Operations -/
136+
109137instance : HasCompl (Set α) := ⟨fun s ↦ {x | x ∉ s}⟩
110138
111139@[simp] theorem mem_compl_iff (s : Set α) (x : α) : x ∈ sᶜ ↔ x ∉ s := Iff.rfl
0 commit comments