Skip to content

Commit efd0084

Browse files
committed
feat(Data/Finset): add InjOn variants of image_{subset,eq}_image_iff (#39556)
These are useful for set family combinatorics
1 parent 6302f63 commit efd0084

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

Mathlib/Data/Finset/Image.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,17 @@ theorem image_subset_image_iff {t : Finset α} (hf : Injective f) :
397397
s.image f ⊆ t.image f ↔ s ⊆ t :=
398398
mod_cast Set.image_subset_image_iff hf (s := s) (t := t)
399399

400+
/-- Variant of `Finset.image_subset_image_iff` under an `InjOn` rather than `Injective`
401+
hypothesis. -/
402+
theorem image_subset_image_iff_of_injOn {s₁ s₂ : Finset α} (ht : (s : Set α).InjOn f)
403+
(h₁ : s₁ ⊆ s) (h₂ : s₂ ⊆ s) : s₁.image f ⊆ s₂.image f ↔ s₁ ⊆ s₂ := by
404+
exact_mod_cast ht.image_subset_image_iff (mod_cast h₁) (mod_cast h₂)
405+
406+
/-- Variant of `Finset.image_inj` under an `InjOn` rather than `Injective` hypothesis. -/
407+
theorem image_eq_image_iff_of_injOn {s₁ s₂ : Finset α} (ht : (s : Set α).InjOn f)
408+
(h₁ : s₁ ⊆ s) (h₂ : s₂ ⊆ s) : s₁.image f = s₂.image f ↔ s₁ = s₂ := by
409+
exact_mod_cast ht.image_eq_image_iff (mod_cast h₁) (mod_cast h₂)
410+
400411
lemma image_ssubset_image {t : Finset α} (hf : Injective f) : s.image f ⊂ t.image f ↔ s ⊂ t := by
401412
simp_rw [← lt_iff_ssubset]
402413
exact lt_iff_lt_of_le_iff_le' (image_subset_image_iff hf) (image_subset_image_iff hf)

Mathlib/Data/Finset/Powerset.lean

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,13 @@ theorem image_injOn_powerset_of_injOn {β : Type*} [DecidableEq β] {f : α →
7878
have {z a} (_ : z ⊆ s) (_ : a ∈ s) : a ∈ z ↔ f a ∈ z.image f := by grind [H.eq_iff]
7979
exact fun _ _ _ _ _ => by grind
8080

81+
/-- Variant of `Finset.image_injOn_powerset_of_injOn` for a family `S` of finsets whose
82+
union supports an `InjOn` hypothesis, rather than the full powerset of a set. -/
83+
theorem injOn_image_of_biUnion_injOn {β : Type*} [DecidableEq α] [DecidableEq β]
84+
{S : Finset (Finset α)} {f : α → β} (hf : (S.biUnion id : Set α).InjOn f) :
85+
(S : Set (Finset α)).InjOn (·.image f) :=
86+
(image_injOn_powerset_of_injOn hf).mono (by aesop (add simp Set.subset_def))
87+
8188
/-- `s.biUnion id ⊆ t` iff every member of `s` is a subset of `t`, i.e. `s ⊆ t.powerset`. -/
8289
lemma biUnion_id_subset_iff_subset_powerset [DecidableEq α] {s : Finset (Finset α)} :
8390
s.biUnion id ⊆ t ↔ s ⊆ t.powerset := by

0 commit comments

Comments
 (0)