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

Commit 0c26348

Browse files
adomanieric-wieser
andcommitted
feat(data/finsupp/basic): finsupp.comap_domain is an add_monoid_hom (#13783)
This is the version of `map_domain.add_monoid_hom` for `comap_domain`. I plan to use it for the inclusion of polynomials in Laurent polynomials (#13415). I also fixed a typo in a doc-string. Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
1 parent a966557 commit 0c26348

File tree

1 file changed

+71
-3
lines changed

1 file changed

+71
-3
lines changed

src/data/finsupp/basic.lean

Lines changed: 71 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,7 +1248,7 @@ end
12481248
/-- Taking the product under `h` is an additive-to-multiplicative homomorphism of finsupps,
12491249
if `h` is an additive-to-multiplicative homomorphism.
12501250
This is a more specialized version of `finsupp.prod_add_index` with simpler hypotheses. -/
1251-
@[to_additive "Taking the product under `h` is an additive homomorphism of finsupps,
1251+
@[to_additive "Taking the sum under `h` is an additive homomorphism of finsupps,
12521252
if `h` is an additive homomorphism.
12531253
This is a more specific version of `finsupp.sum_add_index` with simpler hypotheses."]
12541254
lemma prod_add_index' [add_zero_class M] [comm_monoid N] {f g : α →₀ M}
@@ -1782,6 +1782,7 @@ section comap_domain
17821782
/-- Given `f : α → β`, `l : β →₀ M` and a proof `hf` that `f` is injective on
17831783
the preimage of `l.support`, `comap_domain f l hf` is the finitely supported function
17841784
from `α` to `M` given by composing `l` with `f`. -/
1785+
@[simps support]
17851786
def comap_domain [has_zero M] (f : α → β) (l : β →₀ M) (hf : set.inj_on f (f ⁻¹' ↑l.support)) :
17861787
α →₀ M :=
17871788
{ support := l.support.preimage f hf,
@@ -1819,8 +1820,59 @@ begin
18191820
exact h b (hb.2.symm ▸ ha)
18201821
end
18211822

1822-
lemma map_domain_comap_domain [add_comm_monoid M] (f : α → β) (l : β →₀ M)
1823-
(hf : function.injective f) (hl : ↑l.support ⊆ set.range f):
1823+
section f_injective
1824+
1825+
section has_zero
1826+
variables [has_zero M]
1827+
1828+
/-- Note the `hif` argument is needed for this to work in `rw`. -/
1829+
@[simp] lemma comap_domain_zero (f : α → β)
1830+
(hif : set.inj_on f (f ⁻¹' ↑((0 : β →₀ M).support)) := set.inj_on_empty _) :
1831+
comap_domain f (0 : β →₀ M) hif = (0 : α →₀ M) :=
1832+
by { ext, refl }
1833+
1834+
@[simp] lemma comap_domain_single (f : α → β) (a : α) (m : M)
1835+
(hif : set.inj_on f (f ⁻¹' (single (f a) m).support)) :
1836+
comap_domain f (finsupp.single (f a) m) hif = finsupp.single a m :=
1837+
begin
1838+
rcases eq_or_ne m 0 with rfl | hm,
1839+
{ simp only [single_zero, comap_domain_zero] },
1840+
{ rw [eq_single_iff, comap_domain_apply, comap_domain_support, ← finset.coe_subset, coe_preimage,
1841+
support_single_ne_zero hm, coe_singleton, coe_singleton, single_eq_same],
1842+
rw [support_single_ne_zero hm, coe_singleton] at hif,
1843+
exact ⟨λ x hx, hif hx rfl hx, rfl⟩ }
1844+
end
1845+
1846+
end has_zero
1847+
1848+
section add_zero_class
1849+
variables [add_zero_class M] {f : α → β}
1850+
1851+
lemma comap_domain_add (v₁ v₂ : β →₀ M)
1852+
(hv₁ : set.inj_on f (f ⁻¹' ↑(v₁.support))) (hv₂ : set.inj_on f (f ⁻¹' ↑(v₂.support)))
1853+
(hv₁₂ : set.inj_on f (f ⁻¹' ↑((v₁ + v₂).support))) :
1854+
comap_domain f (v₁ + v₂) hv₁₂ = comap_domain f v₁ hv₁ + comap_domain f v₂ hv₂ :=
1855+
by { ext, simp only [comap_domain_apply, coe_add, pi.add_apply] }
1856+
1857+
/-- A version of `finsupp.comap_domain_add` that's easier to use. -/
1858+
lemma comap_domain_add_of_injective (hf : function.injective f) (v₁ v₂ : β →₀ M) :
1859+
comap_domain f (v₁ + v₂) (hf.inj_on _)
1860+
= comap_domain f v₁ (hf.inj_on _) + comap_domain f v₂ (hf.inj_on _) :=
1861+
comap_domain_add _ _ _ _ _
1862+
1863+
/-- `finsupp.comap_domain` is an `add_monoid_hom`. -/
1864+
@[simps]
1865+
def comap_domain.add_monoid_hom (hf : function.injective f) : (β →₀ M) →+ (α →₀ M) :=
1866+
{ to_fun := λ x, comap_domain f x (hf.inj_on _),
1867+
map_zero' := comap_domain_zero f,
1868+
map_add' := comap_domain_add_of_injective hf }
1869+
1870+
end add_zero_class
1871+
1872+
variables [add_comm_monoid M] (f : α → β)
1873+
1874+
lemma map_domain_comap_domain
1875+
(hf : function.injective f) (l : β →₀ M) (hl : ↑l.support ⊆ set.range f) :
18241876
map_domain f (comap_domain f l (hf.inj_on _)) = l :=
18251877
begin
18261878
ext a,
@@ -1832,6 +1884,8 @@ begin
18321884
apply h_cases (hl $ finset.mem_coe.2 $ mem_support_iff.2 $ λ h, h_contr h.symm) }
18331885
end
18341886

1887+
end f_injective
1888+
18351889
end comap_domain
18361890

18371891
section option
@@ -2500,6 +2554,20 @@ end
25002554
lemma smul_single_one [semiring R] (a : α) (b : R) : b • single a 1 = single a b :=
25012555
by rw [smul_single, smul_eq_mul, mul_one]
25022556

2557+
lemma comap_domain_smul [add_monoid M] [monoid R] [distrib_mul_action R M]
2558+
{f : α → β} (r : R) (v : β →₀ M)
2559+
(hfv : set.inj_on f (f ⁻¹' ↑(v.support)))
2560+
(hfrv : set.inj_on f (f ⁻¹' ↑((r • v).support)) :=
2561+
hfv.mono $ set.preimage_mono $ finset.coe_subset.mpr support_smul):
2562+
comap_domain f (r • v) hfrv = r • comap_domain f v hfv :=
2563+
by { ext, refl }
2564+
2565+
/-- A version of `finsupp.comap_domain_smul` that's easier to use. -/
2566+
lemma comap_domain_smul_of_injective [add_monoid M] [monoid R] [distrib_mul_action R M]
2567+
{f : α → β} (hf : function.injective f) (r : R) (v : β →₀ M) :
2568+
comap_domain f (r • v) (hf.inj_on _) = r • comap_domain f v (hf.inj_on _) :=
2569+
comap_domain_smul _ _ _ _
2570+
25032571
end
25042572

25052573
lemma sum_smul_index [semiring R] [add_comm_monoid M] {g : α →₀ R} {b : R} {h : α → R → M}

0 commit comments

Comments
 (0)