@@ -331,6 +331,26 @@ protected theorem Nonempty.image (h : s.Nonempty) (f : α → β) : (s.image f).
331331
332332alias ⟨Nonempty.of_image, _⟩ := image_nonempty
333333
334+ /-- If the image of a finset is nontrivial, the finset is nontrivial.
335+ For the converse direction under an injectivity hypothesis see `Finset.Nontrivial.image_of_injOn`,
336+ and for the combined iff see `Finset.image_nontrivial_iff_of_injOn`. -/
337+ theorem nontrivial_of_image (h : (s.image f).Nontrivial) : s.Nontrivial := by
338+ simp only [Finset.Nontrivial, coe_image] at h ⊢
339+ exact Set.nontrivial_of_image _ _ h
340+
341+ /-- The image of a nontrivial finset under a function injective on the finset is nontrivial.
342+ For the version assuming `Function.Injective` see `Finset.map_nontrivial`, and for the combined
343+ iff see `Finset.image_nontrivial_iff_of_injOn`. -/
344+ protected theorem Nontrivial.image_of_injOn (hs : s.Nontrivial) (hf : Set.InjOn f s) :
345+ (s.image f).Nontrivial := by
346+ obtain ⟨x, hx, y, hy, hxy⟩ := hs
347+ exact ⟨f x, mem_image_of_mem _ hx, f y, mem_image_of_mem _ hy, (hxy <| hf hx hy ·)⟩
348+
349+ /-- A finset is nontrivial iff its image under a function injective on the finset is. -/
350+ theorem image_nontrivial_iff_of_injOn (hf : Set.InjOn f s) :
351+ (s.image f).Nontrivial ↔ s.Nontrivial :=
352+ ⟨nontrivial_of_image, (·.image_of_injOn hf)⟩
353+
334354theorem image_toFinset [DecidableEq α] {s : Multiset α} :
335355 s.toFinset.image f = (s.map f).toFinset :=
336356 ext fun _ => by simp only [mem_image, Multiset.mem_toFinset, Multiset.mem_map]
0 commit comments