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

Commit 26528b7

Browse files
committed
chore(data/set): add a couple of lemmas (#8430)
1 parent 0190177 commit 26528b7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/data/set/basic.lean

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1583,10 +1583,16 @@ begin
15831583
{ exact λ h, subsingleton.intro (λ a b, set_coe.ext (h a.property b.property)) }
15841584
end
15851585

1586+
/-- The preimage of a subsingleton under an injective map is a subsingleton. -/
1587+
theorem subsingleton.preimage {s : set β} (hs : s.subsingleton) {f : α → β}
1588+
(hf : function.injective f) :
1589+
(f ⁻¹' s).subsingleton :=
1590+
λ a ha b hb, hf $ hs ha hb
1591+
15861592
/-- `s` is a subsingleton, if its image of an injective function is. -/
15871593
theorem subsingleton_of_image {α β : Type*} {f : α → β} (hf : function.injective f)
15881594
(s : set α) (hs : (f '' s).subsingleton) : s.subsingleton :=
1589-
λ a ha b hb, hf $ hs (mem_image_of_mem _ ha) (mem_image_of_mem _ hb)
1595+
(hs.preimage hf).mono $ subset_preimage_image _ _
15901596

15911597
theorem univ_eq_true_false : univ = ({true, false} : set Prop) :=
15921598
eq.symm $ eq_univ_of_forall $ classical.cases (by simp) (by simp)

src/data/set/lattice.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,10 @@ begin
951951
exact exists_swap
952952
end
953953

954+
lemma image_bUnion {f : α → β} {s : ι → set α} {p : ι → Prop} :
955+
f '' (⋃ i (hi : p i), s i) = (⋃ i (hi : p i), f '' s i) :=
956+
by simp only [image_Union]
957+
954958
lemma univ_subtype {p : α → Prop} : (univ : set (subtype p)) = (⋃x (h : p x), {⟨x, h⟩}) :=
955959
set.ext $ assume ⟨x, h⟩, by simp [h]
956960

0 commit comments

Comments
 (0)