Skip to content

Commit e4fa33c

Browse files
committed
feat: Finsupp.mapRange of a surjective function is surjective (#17637)
From PFR
1 parent 7a7d5c0 commit e4fa33c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Mathlib/Data/Finsupp/Defs.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,10 @@ theorem mapRange_comp (f : N → P) (hf : f 0 = 0) (f₂ : M → N) (hf₂ : f
714714
(g : α →₀ M) : mapRange (f ∘ f₂) h g = mapRange f hf (mapRange f₂ hf₂ g) :=
715715
ext fun _ => rfl
716716

717+
@[simp]
718+
lemma mapRange_mapRange (e₁ : N → P) (e₂ : M → N) (he₁ he₂) (f : α →₀ M) :
719+
mapRange e₁ he₁ (mapRange e₂ he₂ f) = mapRange (e₁ ∘ e₂) (by simp [*]) f := ext fun _ ↦ rfl
720+
717721
theorem support_mapRange {f : M → N} {hf : f 0 = 0} {g : α →₀ M} :
718722
(mapRange f hf g).support ⊆ g.support :=
719723
support_onFinset_subset
@@ -730,6 +734,14 @@ theorem support_mapRange_of_injective {e : M → N} (he0 : e 0 = 0) (f : ι →
730734
simp only [Finsupp.mem_support_iff, Ne, Finsupp.mapRange_apply]
731735
exact he.ne_iff' he0
732736

737+
/-- `Finsupp.mapRange` of a surjective function is surjective. -/
738+
lemma mapRange_surjective (e : M → N) (he₀ : e 0 = 0) (he : Surjective e) :
739+
Surjective (Finsupp.mapRange (α := α) e he₀) := by
740+
classical
741+
let d (n : N) : M := if n = 0 then 0 else surjInv he n
742+
have : RightInverse d e := fun n ↦ by by_cases h : n = 0 <;> simp [d, h, he₀, surjInv_eq he n]
743+
exact fun f ↦ ⟨mapRange d (by simp [d]) f, by simp [this.comp_eq_id]⟩
744+
733745
end MapRange
734746

735747
/-! ### Declarations about `embDomain` -/

0 commit comments

Comments
 (0)