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

Commit 2d270ff

Browse files
committed
feat(data/set/basic): +2 lemmas, +2 simp attrs (#3182)
1 parent ef62d1c commit 2d270ff

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/data/set/basic.lean

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1201,6 +1201,19 @@ by rw ← image_union; simp [image_univ_of_surjective H]
12011201
theorem image_compl_eq {f : α → β} {s : set α} (H : bijective f) : f '' -s = -(f '' s) :=
12021202
subset.antisymm (image_compl_subset H.1) (subset_image_compl H.2)
12031203

1204+
theorem subset_image_diff (f : α → β) (s t : set α) :
1205+
f '' s \ f '' t ⊆ f '' (s \ t) :=
1206+
begin
1207+
rw [diff_subset_iff, ← image_union, union_diff_self],
1208+
exact image_subset f (subset_union_right t s)
1209+
end
1210+
1211+
theorem image_diff {f : α → β} (hf : injective f) (s t : set α) :
1212+
f '' (s \ t) = f '' s \ f '' t :=
1213+
subset.antisymm
1214+
(subset.trans (image_inter_subset _ _ _) $ inter_subset_inter_right _ $ image_compl_subset hf)
1215+
(subset_image_diff f s t)
1216+
12041217
lemma nonempty.image (f : α → β) {s : set α} : s.nonempty → (f '' s).nonempty
12051218
| ⟨x, hx⟩ := ⟨f x, mem_image_of_mem f hx⟩
12061219

@@ -1539,15 +1552,15 @@ theorem val_image_subset (s : set α) (t : set (subtype s)) : t.image val ⊆ s
15391552
λ x ⟨y, yt, yvaleq⟩, by rw ←yvaleq; exact y.property
15401553

15411554
theorem val_image_univ (s : set α) : @val _ s '' set.univ = s :=
1542-
set.eq_of_subset_of_subset (val_image_subset _ _) (λ x xs, ⟨⟨x, xs⟩, ⟨set.mem_univ _, rfl⟩⟩)
1555+
image_univ.trans (range_val s)
15431556

1544-
theorem image_preimage_val (s t : set α) :
1557+
@[simp] theorem image_preimage_val (s t : set α) :
15451558
(@subtype.val _ s) '' ((@subtype.val _ s) ⁻¹' t) = t ∩ s :=
1546-
begin
1547-
ext x, simp, split,
1548-
{ rintros ⟨y, ys, yt, yx⟩, rw ←yx, exact ⟨yt, ys⟩ },
1549-
rintros ⟨xt, xs⟩, exact ⟨x, xs, xt, rfl⟩
1550-
end
1559+
image_preimage_eq_inter_range.trans $ congr_arg _ (range_val s)
1560+
1561+
@[simp] theorem image_preimage_coe (s t : set α) :
1562+
(coe : s → α) '' (coe ⁻¹' t) = t ∩ s :=
1563+
image_preimage_val s t
15511564

15521565
theorem preimage_val_eq_preimage_val_iff (s t u : set α) :
15531566
((@subtype.val _ s) ⁻¹' t = (@subtype.val _ s) ⁻¹' u) ↔ (t ∩ s = u ∩ s) :=
@@ -1558,7 +1571,7 @@ begin
15581571
end
15591572

15601573
lemma exists_set_subtype {t : set α} (p : set α → Prop) :
1561-
(∃(s : set t), p (subtype.val '' s)) ↔ ∃(s : set α), s ⊆ t ∧ p s :=
1574+
(∃(s : set t), p (subtype.val '' s)) ↔ ∃(s : set α), s ⊆ t ∧ p s :=
15621575
begin
15631576
split,
15641577
{ rintro ⟨s, hs⟩, refine ⟨subtype.val '' s, _, hs⟩,

0 commit comments

Comments
 (0)