Skip to content

Commit

Permalink
chore(data/set): add a couple of lemmas (#8430)
Browse files Browse the repository at this point in the history
  • Loading branch information
urkud committed Jul 26, 2021
1 parent 0190177 commit 26528b7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/data/set/basic.lean
Expand Up @@ -1583,10 +1583,16 @@ begin
{ exact λ h, subsingleton.intro (λ a b, set_coe.ext (h a.property b.property)) }
end

/-- The preimage of a subsingleton under an injective map is a subsingleton. -/
theorem subsingleton.preimage {s : set β} (hs : s.subsingleton) {f : α → β}
(hf : function.injective f) :
(f ⁻¹' s).subsingleton :=
λ a ha b hb, hf $ hs ha hb

/-- `s` is a subsingleton, if its image of an injective function is. -/
theorem subsingleton_of_image {α β : Type*} {f : α → β} (hf : function.injective f)
(s : set α) (hs : (f '' s).subsingleton) : s.subsingleton :=
λ a ha b hb, hf $ hs (mem_image_of_mem _ ha) (mem_image_of_mem _ hb)
(hs.preimage hf).mono $ subset_preimage_image _ _

theorem univ_eq_true_false : univ = ({true, false} : set Prop) :=
eq.symm $ eq_univ_of_forall $ classical.cases (by simp) (by simp)
Expand Down
4 changes: 4 additions & 0 deletions src/data/set/lattice.lean
Expand Up @@ -951,6 +951,10 @@ begin
exact exists_swap
end

lemma image_bUnion {f : α → β} {s : ι → set α} {p : ι → Prop} :
f '' (⋃ i (hi : p i), s i) = (⋃ i (hi : p i), f '' s i) :=
by simp only [image_Union]

lemma univ_subtype {p : α → Prop} : (univ : set (subtype p)) = (⋃x (h : p x), {⟨x, h⟩}) :=
set.ext $ assume ⟨x, h⟩, by simp [h]

Expand Down

0 comments on commit 26528b7

Please sign in to comment.