@@ -381,6 +381,14 @@ theorem prod_congr (h : s₁ = s₂) : (∀ x ∈ s₂, f x = g x) → s₁.prod
381
381
#align finset.prod_congr Finset.prod_congr
382
382
#align finset.sum_congr Finset.sum_congr
383
383
384
+ @[to_additive]
385
+ theorem prod_eq_one {f : α → β} {s : Finset α} (h : ∀ x ∈ s, f x = 1 ) : ∏ x in s, f x = 1 :=
386
+ calc
387
+ ∏ x in s, f x = ∏ _x in s, 1 := Finset.prod_congr rfl h
388
+ _ = 1 := Finset.prod_const_one
389
+ #align finset.prod_eq_one Finset.prod_eq_one
390
+ #align finset.sum_eq_zero Finset.sum_eq_zero
391
+
384
392
@[to_additive]
385
393
theorem prod_disjUnion (h) :
386
394
∏ x in s₁.disjUnion s₂ h, f x = (∏ x in s₁, f x) * ∏ x in s₂, f x := by
@@ -499,6 +507,22 @@ theorem prod_sdiff [DecidableEq α] (h : s₁ ⊆ s₂) :
499
507
#align finset.prod_sdiff Finset.prod_sdiff
500
508
#align finset.sum_sdiff Finset.sum_sdiff
501
509
510
+ @[to_additive]
511
+ theorem prod_subset_one_on_sdiff [DecidableEq α] (h : s₁ ⊆ s₂) (hg : ∀ x ∈ s₂ \ s₁, g x = 1 )
512
+ (hfg : ∀ x ∈ s₁, f x = g x) : ∏ i in s₁, f i = ∏ i in s₂, g i := by
513
+ rw [← prod_sdiff h, prod_eq_one hg, one_mul]
514
+ exact prod_congr rfl hfg
515
+ #align finset.prod_subset_one_on_sdiff Finset.prod_subset_one_on_sdiff
516
+ #align finset.sum_subset_zero_on_sdiff Finset.sum_subset_zero_on_sdiff
517
+
518
+ @[to_additive]
519
+ theorem prod_subset (h : s₁ ⊆ s₂) (hf : ∀ x ∈ s₂, x ∉ s₁ → f x = 1 ) :
520
+ ∏ x in s₁, f x = ∏ x in s₂, f x :=
521
+ haveI := Classical.decEq α
522
+ prod_subset_one_on_sdiff h (by simpa) fun _ _ => rfl
523
+ #align finset.prod_subset Finset.prod_subset
524
+ #align finset.sum_subset Finset.sum_subset
525
+
502
526
@[to_additive (attr := simp)]
503
527
theorem prod_disj_sum (s : Finset α) (t : Finset γ) (f : Sum α γ → β) :
504
528
∏ x in s.disjSum t, f x = (∏ x in s, f (Sum.inl x)) * ∏ x in t, f (Sum.inr x) := by
@@ -652,6 +676,14 @@ lemma prod_bijective (e : ι → κ) (he : e.Bijective) (hst : ∀ i, i ∈ s
652
676
(hfg : ∀ i ∈ s, f i = g (e i)) :
653
677
∏ i in s, f i = ∏ i in t, g i := prod_equiv (.ofBijective e he) hst hfg
654
678
679
+ @[to_additive]
680
+ lemma prod_of_injOn (e : ι → κ) (he : Set.InjOn e s) (hest : Set.MapsTo e s t)
681
+ (h' : ∀ i ∈ t, i ∉ e '' s → g i = 1 ) (h : ∀ i ∈ s, f i = g (e i)) :
682
+ ∏ i in s, f i = ∏ j in t, g j := by
683
+ classical
684
+ exact (prod_nbij e (fun a ↦ mem_image_of_mem e) he (by simp [Set.surjOn_image]) h).trans $
685
+ prod_subset (image_subset_iff.2 hest) $ by simpa using h'
686
+
655
687
variable [DecidableEq κ]
656
688
657
689
@[to_additive]
@@ -813,30 +845,6 @@ theorem prod_hom_rel [CommMonoid γ] {r : β → γ → Prop} {f : α → β} {g
813
845
#align finset.prod_hom_rel Finset.prod_hom_rel
814
846
#align finset.sum_hom_rel Finset.sum_hom_rel
815
847
816
- @[to_additive]
817
- theorem prod_eq_one {f : α → β} {s : Finset α} (h : ∀ x ∈ s, f x = 1 ) : ∏ x in s, f x = 1 :=
818
- calc
819
- ∏ x in s, f x = ∏ _x in s, 1 := Finset.prod_congr rfl h
820
- _ = 1 := Finset.prod_const_one
821
- #align finset.prod_eq_one Finset.prod_eq_one
822
- #align finset.sum_eq_zero Finset.sum_eq_zero
823
-
824
- @[to_additive]
825
- theorem prod_subset_one_on_sdiff [DecidableEq α] (h : s₁ ⊆ s₂) (hg : ∀ x ∈ s₂ \ s₁, g x = 1 )
826
- (hfg : ∀ x ∈ s₁, f x = g x) : ∏ i in s₁, f i = ∏ i in s₂, g i := by
827
- rw [← prod_sdiff h, prod_eq_one hg, one_mul]
828
- exact prod_congr rfl hfg
829
- #align finset.prod_subset_one_on_sdiff Finset.prod_subset_one_on_sdiff
830
- #align finset.sum_subset_zero_on_sdiff Finset.sum_subset_zero_on_sdiff
831
-
832
- @[to_additive]
833
- theorem prod_subset (h : s₁ ⊆ s₂) (hf : ∀ x ∈ s₂, x ∉ s₁ → f x = 1 ) :
834
- ∏ x in s₁, f x = ∏ x in s₂, f x :=
835
- haveI := Classical.decEq α
836
- prod_subset_one_on_sdiff h (by simpa) fun _ _ => rfl
837
- #align finset.prod_subset Finset.prod_subset
838
- #align finset.sum_subset Finset.sum_subset
839
-
840
848
@[to_additive]
841
849
theorem prod_filter_of_ne {p : α → Prop } [DecidablePred p] (hp : ∀ x ∈ s, f x ≠ 1 → p x) :
842
850
∏ x in s.filter p, f x = ∏ x in s, f x :=
@@ -2208,6 +2216,11 @@ lemma _root_.Equiv.prod_comp (e : ι ≃ κ) (g : κ → α) : ∏ i, g (e i) =
2208
2216
#align equiv.prod_comp Equiv.prod_comp
2209
2217
#align equiv.sum_comp Equiv.sum_comp
2210
2218
2219
+ @[to_additive]
2220
+ lemma prod_of_injective (e : ι → κ) (hf : Injective e) (f : ι → α) (g : κ → α)
2221
+ (h' : ∀ i ∉ Set.range e, g i = 1 ) (h : ∀ i, f i = g (e i)) : ∏ i, f i = ∏ j, g j :=
2222
+ prod_of_injOn e (hf.injOn _) (by simp) (by simpa using h') (fun i _ ↦ h i)
2223
+
2211
2224
@[to_additive]
2212
2225
lemma prod_fiberwise [DecidableEq κ] [Fintype ι] (g : ι → κ) (f : ι → α) :
2213
2226
∏ j, ∏ i : {i // g i = j}, f i = ∏ i, f i := by
0 commit comments