@@ -1248,7 +1248,7 @@ end
1248
1248
/-- Taking the product under `h` is an additive-to-multiplicative homomorphism of finsupps,
1249
1249
if `h` is an additive-to-multiplicative homomorphism.
1250
1250
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,
1252
1252
if `h` is an additive homomorphism.
1253
1253
This is a more specific version of `finsupp.sum_add_index` with simpler hypotheses." ]
1254
1254
lemma prod_add_index' [add_zero_class M] [comm_monoid N] {f g : α →₀ M}
@@ -1782,6 +1782,7 @@ section comap_domain
1782
1782
/-- Given `f : α → β`, `l : β →₀ M` and a proof `hf` that `f` is injective on
1783
1783
the preimage of `l.support`, `comap_domain f l hf` is the finitely supported function
1784
1784
from `α` to `M` given by composing `l` with `f`. -/
1785
+ @[simps support]
1785
1786
def comap_domain [has_zero M] (f : α → β) (l : β →₀ M) (hf : set.inj_on f (f ⁻¹' ↑l.support)) :
1786
1787
α →₀ M :=
1787
1788
{ support := l.support.preimage f hf,
@@ -1819,8 +1820,59 @@ begin
1819
1820
exact h b (hb.2 .symm ▸ ha)
1820
1821
end
1821
1822
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) :
1824
1876
map_domain f (comap_domain f l (hf.inj_on _)) = l :=
1825
1877
begin
1826
1878
ext a,
@@ -1832,6 +1884,8 @@ begin
1832
1884
apply h_cases (hl $ finset.mem_coe.2 $ mem_support_iff.2 $ λ h, h_contr h.symm) }
1833
1885
end
1834
1886
1887
+ end f_injective
1888
+
1835
1889
end comap_domain
1836
1890
1837
1891
section option
@@ -2500,6 +2554,20 @@ end
2500
2554
lemma smul_single_one [semiring R] (a : α) (b : R) : b • single a 1 = single a b :=
2501
2555
by rw [smul_single, smul_eq_mul, mul_one]
2502
2556
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
+
2503
2571
end
2504
2572
2505
2573
lemma sum_smul_index [semiring R] [add_comm_monoid M] {g : α →₀ R} {b : R} {h : α → R → M}
0 commit comments