algebra.big_operators.ring
⟷
Mathlib.Algebra.BigOperators.Ring
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
multiset.pi_cons_injective
is about multiset.pi.cons
so should have a .
in its name.multiset.pi.cons_ext
is not an ext lemma, but more closely resembles eta-reduction.This also groups together the lemmas about pi.cons
.
@@ -101,7 +101,7 @@ begin
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_bUnion h₁],
refine sum_congr rfl (λ b _, _),
have h₂ : ∀p₁∈pi s t, ∀p₂∈pi s t, pi.cons s a b p₁ = pi.cons s a b p₂ → p₁ = p₂, from
- assume p₁ h₁ p₂ h₂ eq, pi_cons_injective ha eq,
+ assume p₁ h₁ p₂ h₂ eq, pi.cons_injective ha eq,
rw [sum_image h₂, mul_sum],
refine sum_congr rfl (λ g _, _),
rw [attach_insert, prod_insert, prod_image],
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -123,7 +123,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
rintro _ ⟨p₂, hp, eq₂⟩ _ ⟨p₃, hp₃, eq₃⟩ eq
have : pi.cons s a x p₂ a (mem_insert_self _ _) = pi.cons s a y p₃ a (mem_insert_self _ _) :=
by rw [eq₂, eq₃, Eq]
- rw [pi.cons_same, pi.cons_same] at this
+ rw [pi.cons_same, pi.cons_same] at this
exact h this
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_bUnion h₁]
refine' sum_congr rfl fun b _ => _
@@ -173,7 +173,7 @@ theorem prod_add (f g : α → β) (s : Finset α) :
(prod_bij (fun (a : α) (ha : a ∈ s \ t) => ⟨a, by simp_all⟩) _ _ _ fun b hb =>
⟨b, by
cases b <;>
- · simp only [true_and_iff, mem_filter, mem_attach, Subtype.coe_mk] at hb
+ · simp only [true_and_iff, mem_filter, mem_attach, Subtype.coe_mk] at hb
simpa only [true_and_iff, exists_prop, and_true_iff, mem_sdiff,
eq_self_iff_true, Subtype.coe_mk, b_property]⟩) <;>
intros <;>
@@ -181,7 +181,7 @@ theorem prod_add (f g : α → β) (s : Finset α) :
simp_all
· intro a₁ a₂ h₁ h₂ H
ext x
- simp only [Function.funext_iff, subset_iff, mem_powerset, eq_iff_iff] at h₁ h₂ H
+ simp only [Function.funext_iff, subset_iff, mem_powerset, eq_iff_iff] at h₁ h₂ H
exact ⟨fun hx => (H x (h₁ hx)).1 hx, fun hx => (H x (h₂ hx)).2 hx⟩
· intro f hf
exact ⟨s.filter fun a : α => ∃ h : a ∈ s, f a h, by simp, by funext <;> intros <;> simp [*]⟩
@@ -274,7 +274,7 @@ theorem prod_range_cast_nat_sub (n k : ℕ) :
rw [prod_nat_cast]
cases' le_or_lt k n with hkn hnk
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
- · rw [← mem_range] at hnk
+ · rw [← mem_range] at hnk
rw [prod_eq_zero hnk, prod_eq_zero hnk] <;> simp
#align finset.prod_range_cast_nat_sub Finset.prod_range_cast_nat_sub
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -56,13 +56,13 @@ variable [NonUnitalNonAssocSemiring β]
#print Finset.sum_mul /-
theorem sum_mul : (∑ x in s, f x) * b = ∑ x in s, f x * b :=
- AddMonoidHom.map_sum (AddMonoidHom.mulRight b) _ s
+ map_sum (AddMonoidHom.mulRight b) _ s
#align finset.sum_mul Finset.sum_mul
-/
#print Finset.mul_sum /-
theorem mul_sum : b * ∑ x in s, f x = ∑ x in s, b * f x :=
- AddMonoidHom.map_sum (AddMonoidHom.mulLeft b) _ s
+ map_sum (AddMonoidHom.mulLeft b) _ s
#align finset.mul_sum Finset.mul_sum
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/b1abe23ae96fef89ad30d9f4362c307f72a55010
@@ -310,7 +310,7 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
@[to_additive
"A sum over `powerset s` is equal to the double sum over sets of subsets of `s` with\n`card s = k`, for `k = 1, ..., card s`"]
theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
- ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
+ ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetCard j s, f t := by
rw [powerset_card_disj_Union, prod_disj_Union]
#align finset.prod_powerset Finset.prod_powerset
#align finset.sum_powerset Finset.sum_powerset
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,10 +3,10 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
-/
-import Mathbin.Algebra.BigOperators.Basic
-import Mathbin.Algebra.Field.Defs
-import Mathbin.Data.Finset.Pi
-import Mathbin.Data.Finset.Powerset
+import Algebra.BigOperators.Basic
+import Algebra.Field.Defs
+import Data.Finset.Pi
+import Data.Finset.Powerset
#align_import algebra.big_operators.ring from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,17 +2,14 @@
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
-
-! This file was ported from Lean 3 source module algebra.big_operators.ring
-! leanprover-community/mathlib commit b2c89893177f66a48daf993b7ba5ef7cddeff8c9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.BigOperators.Basic
import Mathbin.Algebra.Field.Defs
import Mathbin.Data.Finset.Pi
import Mathbin.Data.Finset.Powerset
+#align_import algebra.big_operators.ring from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
+
/-!
# Results about big operators with values in a (semi)ring
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -57,19 +57,25 @@ section Semiring
variable [NonUnitalNonAssocSemiring β]
+#print Finset.sum_mul /-
theorem sum_mul : (∑ x in s, f x) * b = ∑ x in s, f x * b :=
AddMonoidHom.map_sum (AddMonoidHom.mulRight b) _ s
#align finset.sum_mul Finset.sum_mul
+-/
+#print Finset.mul_sum /-
theorem mul_sum : b * ∑ x in s, f x = ∑ x in s, b * f x :=
AddMonoidHom.map_sum (AddMonoidHom.mulLeft b) _ s
#align finset.mul_sum Finset.mul_sum
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print Finset.sum_mul_sum /-
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
(f₂ : ι₂ → β) : (∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂ = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 := by
rw [sum_product, sum_mul, sum_congr rfl]; intros; rw [mul_sum]
#align finset.sum_mul_sum Finset.sum_mul_sum
+-/
end Semiring
@@ -77,24 +83,31 @@ section Semiring
variable [NonAssocSemiring β]
+#print Finset.sum_mul_boole /-
theorem sum_mul_boole [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
∑ x in s, f x * ite (a = x) 1 0 = ite (a ∈ s) (f a) 0 := by simp
#align finset.sum_mul_boole Finset.sum_mul_boole
+-/
+#print Finset.sum_boole_mul /-
theorem sum_boole_mul [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
∑ x in s, ite (a = x) 1 0 * f x = ite (a ∈ s) (f a) 0 := by simp
#align finset.sum_boole_mul Finset.sum_boole_mul
+-/
end Semiring
+#print Finset.sum_div /-
theorem sum_div [DivisionSemiring β] {s : Finset α} {f : α → β} {b : β} :
(∑ x in s, f x) / b = ∑ x in s, f x / b := by simp only [div_eq_mul_inv, sum_mul]
#align finset.sum_div Finset.sum_div
+-/
section CommSemiring
variable [CommSemiring β]
+#print Finset.prod_sum /-
/-- The product over a sum can be written as a sum over the product of sets, `finset.pi`.
`finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
@@ -128,9 +141,11 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
· exact fun _ _ _ _ => Subtype.eq ∘ Subtype.mk.inj
· simp only [mem_image]; rintro ⟨⟨_, hm⟩, _, rfl⟩; exact ha hm
#align finset.prod_sum Finset.prod_sum
+-/
open scoped Classical
+#print Finset.prod_add /-
/-- The product of `f a + g a` over all of `s` is the sum
over the powerset of `s` of the product of `f` over a subset `t` times
the product of `g` over the complement of `t` -/
@@ -174,7 +189,9 @@ theorem prod_add (f g : α → β) (s : Finset α) :
· intro f hf
exact ⟨s.filter fun a : α => ∃ h : a ∈ s, f a h, by simp, by funext <;> intros <;> simp [*]⟩
#align finset.prod_add Finset.prod_add
+-/
+#print Finset.prod_add_ordered /-
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
(f g : ι → R) :
@@ -197,7 +214,9 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
mul_left_comm]
exact mt (fun ha => (mem_filter.1 ha).1) ha'
#align finset.prod_add_ordered Finset.prod_add_ordered
+-/
+#print Finset.prod_sub_ordered /-
/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
∏ i in s, (f i - g i) =
@@ -209,14 +228,18 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
convert prod_add_ordered s f fun i => -g i
simp
#align finset.prod_sub_ordered Finset.prod_sub_ordered
+-/
+#print Finset.prod_one_sub_ordered /-
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
(f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filterₓ (· < i), (1 - f j) :=
by rw [prod_sub_ordered]; simp
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
+-/
+#print Finset.sum_pow_mul_eq_add_pow /-
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `finset`
gives `(a + b)^s.card`.-/
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
@@ -226,6 +249,7 @@ theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : F
refine' Finset.sum_congr rfl fun t ht => _
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
#align finset.sum_pow_mul_eq_add_pow Finset.sum_pow_mul_eq_add_pow
+-/
#print Finset.dvd_sum /-
theorem dvd_sum {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣ f x) : b ∣ ∑ x in s, f x :=
@@ -246,6 +270,7 @@ section CommRing
variable {R : Type _} [CommRing R]
+#print Finset.prod_range_cast_nat_sub /-
theorem prod_range_cast_nat_sub (n k : ℕ) :
∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
by
@@ -255,9 +280,11 @@ theorem prod_range_cast_nat_sub (n k : ℕ) :
· rw [← mem_range] at hnk
rw [prod_eq_zero hnk, prod_eq_zero hnk] <;> simp
#align finset.prod_range_cast_nat_sub Finset.prod_range_cast_nat_sub
+-/
end CommRing
+#print Finset.prod_powerset_insert /-
/-- A product over all subsets of `s ∪ {x}` is obtained by multiplying the product over all subsets
of `s`, and over all subsets of `s` to which one adds `x`. -/
@[to_additive
@@ -278,6 +305,7 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
exact ne_insert_of_not_mem _ _ (not_mem_of_mem_powerset_of_not_mem h₁ h)
#align finset.prod_powerset_insert Finset.prod_powerset_insert
#align finset.sum_powerset_insert Finset.sum_powerset_insert
+-/
#print Finset.prod_powerset /-
/-- A product over `powerset s` is equal to the double product over sets of subsets of `s` with
@@ -291,6 +319,7 @@ theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
#align finset.sum_powerset Finset.sum_powerset
-/
+#print Finset.sum_range_succ_mul_sum_range_succ /-
theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k : ℕ) (f g : ℕ → β) :
(∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i =
(∑ i in range n, f i) * ∑ i in range k, g i + f n * ∑ i in range k, g i +
@@ -298,6 +327,7 @@ theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k :
f n * g k :=
by simp only [add_mul, mul_add, add_assoc, sum_range_succ]
#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succ
+-/
end Finset
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -42,7 +42,7 @@ open scoped Classical
#print Finset.prod_pow_eq_pow_sum /-
theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
- ∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x :=
+ ∀ {s : Finset α}, ∏ i in s, x ^ f i = x ^ ∑ x in s, f x :=
by
apply Finset.induction
· simp
@@ -61,14 +61,14 @@ theorem sum_mul : (∑ x in s, f x) * b = ∑ x in s, f x * b :=
AddMonoidHom.map_sum (AddMonoidHom.mulRight b) _ s
#align finset.sum_mul Finset.sum_mul
-theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
+theorem mul_sum : b * ∑ x in s, f x = ∑ x in s, b * f x :=
AddMonoidHom.map_sum (AddMonoidHom.mulLeft b) _ s
#align finset.mul_sum Finset.mul_sum
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
- (f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 :=
- by rw [sum_product, sum_mul, sum_congr rfl]; intros; rw [mul_sum]
+ (f₂ : ι₂ → β) : (∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂ = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 := by
+ rw [sum_product, sum_mul, sum_congr rfl]; intros; rw [mul_sum]
#align finset.sum_mul_sum Finset.sum_mul_sum
end Semiring
@@ -78,11 +78,11 @@ section Semiring
variable [NonAssocSemiring β]
theorem sum_mul_boole [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
- (∑ x in s, f x * ite (a = x) 1 0) = ite (a ∈ s) (f a) 0 := by simp
+ ∑ x in s, f x * ite (a = x) 1 0 = ite (a ∈ s) (f a) 0 := by simp
#align finset.sum_mul_boole Finset.sum_mul_boole
theorem sum_boole_mul [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
- (∑ x in s, ite (a = x) 1 0 * f x) = ite (a ∈ s) (f a) 0 := by simp
+ ∑ x in s, ite (a = x) 1 0 * f x = ite (a ∈ s) (f a) 0 := by simp
#align finset.sum_boole_mul Finset.sum_boole_mul
end Semiring
@@ -99,7 +99,7 @@ variable [CommSemiring β]
`finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
{t : ∀ a, Finset (δ a)} {f : ∀ a, δ a → β} :
- (∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) :=
+ ∏ a in s, ∑ b in t a, f a b = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) :=
by
induction' s using Finset.induction with a s ha ih
· rw [pi_empty, sum_singleton]; rfl
@@ -135,9 +135,9 @@ open scoped Classical
over the powerset of `s` of the product of `f` over a subset `t` times
the product of `g` over the complement of `t` -/
theorem prod_add (f g : α → β) (s : Finset α) :
- (∏ a in s, f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
+ ∏ a in s, (f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
calc
- (∏ a in s, f a + g a) =
+ ∏ a in s, (f a + g a) =
∏ a in s, ∑ p in ({True, False} : Finset Prop), if p then f a else g a :=
by simp
_ =
@@ -178,10 +178,10 @@ theorem prod_add (f g : α → β) (s : Finset α) :
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
(f g : ι → R) :
- (∏ i in s, f i + g i) =
- (∏ i in s, f i) +
+ ∏ i in s, (f i + g i) =
+ ∏ i in s, f i +
∑ i in s,
- (g i * ∏ j in s.filterₓ (· < i), f j + g j) * ∏ j in s.filterₓ fun j => i < j, f j :=
+ (g i * ∏ j in s.filterₓ (· < i), (f j + g j)) * ∏ j in s.filterₓ fun j => i < j, f j :=
by
refine' Finset.induction_on_max s (by simp) _
clear s; intro a s ha ihs
@@ -200,10 +200,10 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
- (∏ i in s, f i - g i) =
- (∏ i in s, f i) -
+ ∏ i in s, (f i - g i) =
+ ∏ i in s, f i -
∑ i in s,
- (g i * ∏ j in s.filterₓ (· < i), f j - g j) * ∏ j in s.filterₓ fun j => i < j, f j :=
+ (g i * ∏ j in s.filterₓ (· < i), (f j - g j)) * ∏ j in s.filterₓ fun j => i < j, f j :=
by
simp only [sub_eq_add_neg]
convert prod_add_ordered s f fun i => -g i
@@ -213,14 +213,14 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
- (f : ι → R) : (∏ i in s, 1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filterₓ (· < i), 1 - f j := by
- rw [prod_sub_ordered]; simp
+ (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filterₓ (· < i), (1 - f j) :=
+ by rw [prod_sub_ordered]; simp
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `finset`
gives `(a + b)^s.card`.-/
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
- (∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card :=
+ ∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card) = (a + b) ^ s.card :=
by
rw [← prod_const, prod_add]
refine' Finset.sum_congr rfl fun t ht => _
@@ -247,7 +247,7 @@ section CommRing
variable {R : Type _} [CommRing R]
theorem prod_range_cast_nat_sub (n k : ℕ) :
- (∏ i in range k, (n - i : R)) = (∏ i in range k, n - i : ℕ) :=
+ ∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
by
rw [prod_nat_cast]
cases' le_or_lt k n with hkn hnk
@@ -264,7 +264,7 @@ of `s`, and over all subsets of `s` to which one adds `x`. -/
"A sum over all subsets of `s ∪ {x}` is obtained by summing the sum over all subsets\nof `s`, and over all subsets of `s` to which one adds `x`."]
theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x : α} (h : x ∉ s)
(f : Finset α → β) :
- (∏ a in (insert x s).powerset, f a) =
+ ∏ a in (insert x s).powerset, f a =
(∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) :=
by
rw [powerset_insert, Finset.prod_union, Finset.prod_image]
@@ -285,15 +285,15 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
@[to_additive
"A sum over `powerset s` is equal to the double sum over sets of subsets of `s` with\n`card s = k`, for `k = 1, ..., card s`"]
theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
- (∏ t in powerset s, f t) = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
+ ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
rw [powerset_card_disj_Union, prod_disj_Union]
#align finset.prod_powerset Finset.prod_powerset
#align finset.sum_powerset Finset.sum_powerset
-/
theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k : ℕ) (f g : ℕ → β) :
- ((∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i) =
- (((∑ i in range n, f i) * ∑ i in range k, g i) + f n * ∑ i in range k, g i) +
+ (∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i =
+ (∑ i in range n, f i) * ∑ i in range k, g i + f n * ∑ i in range k, g i +
(∑ i in range n, f i) * g k +
f n * g k :=
by simp only [add_mul, mul_add, add_assoc, sum_range_succ]
mathlib commit https://github.com/leanprover-community/mathlib/commit/7e5137f579de09a059a5ce98f364a04e221aabf0
@@ -173,7 +173,6 @@ theorem prod_add (f g : α → β) (s : Finset α) :
exact ⟨fun hx => (H x (h₁ hx)).1 hx, fun hx => (H x (h₂ hx)).2 hx⟩
· intro f hf
exact ⟨s.filter fun a : α => ∃ h : a ∈ s, f a h, by simp, by funext <;> intros <;> simp [*]⟩
-
#align finset.prod_add Finset.prod_add
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -68,7 +68,7 @@ theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
(f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 :=
- by rw [sum_product, sum_mul, sum_congr rfl]; intros ; rw [mul_sum]
+ by rw [sum_product, sum_mul, sum_congr rfl]; intros; rw [mul_sum]
#align finset.sum_mul_sum Finset.sum_mul_sum
end Semiring
@@ -113,7 +113,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
rintro _ ⟨p₂, hp, eq₂⟩ _ ⟨p₃, hp₃, eq₃⟩ eq
have : pi.cons s a x p₂ a (mem_insert_self _ _) = pi.cons s a y p₃ a (mem_insert_self _ _) :=
by rw [eq₂, eq₃, Eq]
- rw [pi.cons_same, pi.cons_same] at this
+ rw [pi.cons_same, pi.cons_same] at this
exact h this
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_bUnion h₁]
refine' sum_congr rfl fun b _ => _
@@ -161,15 +161,15 @@ theorem prod_add (f g : α → β) (s : Finset α) :
(prod_bij (fun (a : α) (ha : a ∈ s \ t) => ⟨a, by simp_all⟩) _ _ _ fun b hb =>
⟨b, by
cases b <;>
- · simp only [true_and_iff, mem_filter, mem_attach, Subtype.coe_mk] at hb
+ · simp only [true_and_iff, mem_filter, mem_attach, Subtype.coe_mk] at hb
simpa only [true_and_iff, exists_prop, and_true_iff, mem_sdiff,
- eq_self_iff_true, Subtype.coe_mk, b_property] ⟩) <;>
+ eq_self_iff_true, Subtype.coe_mk, b_property]⟩) <;>
intros <;>
simp_all <;>
simp_all
· intro a₁ a₂ h₁ h₂ H
ext x
- simp only [Function.funext_iff, subset_iff, mem_powerset, eq_iff_iff] at h₁ h₂ H
+ simp only [Function.funext_iff, subset_iff, mem_powerset, eq_iff_iff] at h₁ h₂ H
exact ⟨fun hx => (H x (h₁ hx)).1 hx, fun hx => (H x (h₂ hx)).2 hx⟩
· intro f hf
exact ⟨s.filter fun a : α => ∃ h : a ∈ s, f a h, by simp, by funext <;> intros <;> simp [*]⟩
@@ -253,7 +253,7 @@ theorem prod_range_cast_nat_sub (n k : ℕ) :
rw [prod_nat_cast]
cases' le_or_lt k n with hkn hnk
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
- · rw [← mem_range] at hnk
+ · rw [← mem_range] at hnk
rw [prod_eq_zero hnk, prod_eq_zero hnk] <;> simp
#align finset.prod_range_cast_nat_sub Finset.prod_range_cast_nat_sub
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -26,7 +26,7 @@ multiplicative and additive structures on the values being combined.
universe u v w
-open BigOperators
+open scoped BigOperators
variable {α : Type u} {β : Type v} {γ : Type w}
@@ -38,7 +38,7 @@ section CommMonoid
variable [CommMonoid β]
-open Classical
+open scoped Classical
#print Finset.prod_pow_eq_pow_sum /-
theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
@@ -129,7 +129,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
· simp only [mem_image]; rintro ⟨⟨_, hm⟩, _, rfl⟩; exact ha hm
#align finset.prod_sum Finset.prod_sum
-open Classical
+open scoped Classical
/-- The product of `f a + g a` over all of `s` is the sum
over the powerset of `s` of the product of `f` over a subset `t` times
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -57,32 +57,14 @@ section Semiring
variable [NonUnitalNonAssocSemiring β]
-/- warning: finset.sum_mul -> Finset.sum_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {b : β} {f : α -> β} [_inst_1 : NonUnitalNonAssocSemiring.{u2} β], Eq.{succ u2} β (HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β _inst_1))) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => f x)) b) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β _inst_1))) (f x) b))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {b : β} {f : α -> β} [_inst_1 : NonUnitalNonAssocSemiring.{u2} β], Eq.{succ u2} β (HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β _inst_1)) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => f x)) b) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β _inst_1)) (f x) b))
-Case conversion may be inaccurate. Consider using '#align finset.sum_mul Finset.sum_mulₓ'. -/
theorem sum_mul : (∑ x in s, f x) * b = ∑ x in s, f x * b :=
AddMonoidHom.map_sum (AddMonoidHom.mulRight b) _ s
#align finset.sum_mul Finset.sum_mul
-/- warning: finset.mul_sum -> Finset.mul_sum is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {b : β} {f : α -> β} [_inst_1 : NonUnitalNonAssocSemiring.{u2} β], Eq.{succ u2} β (HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β _inst_1))) b (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => f x))) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β _inst_1))) b (f x)))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {s : Finset.{u1} α} {b : β} {f : α -> β} [_inst_1 : NonUnitalNonAssocSemiring.{u2} β], Eq.{succ u2} β (HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β _inst_1)) b (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => f x))) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β _inst_1) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β _inst_1)) b (f x)))
-Case conversion may be inaccurate. Consider using '#align finset.mul_sum Finset.mul_sumₓ'. -/
theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
AddMonoidHom.map_sum (AddMonoidHom.mulLeft b) _ s
#align finset.mul_sum Finset.mul_sum
-/- warning: finset.sum_mul_sum -> Finset.sum_mul_sum is a dubious translation:
-lean 3 declaration is
- forall {β : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} β] {ι₁ : Type.{u2}} {ι₂ : Type.{u3}} (s₁ : Finset.{u2} ι₁) (s₂ : Finset.{u3} ι₂) (f₁ : ι₁ -> β) (f₂ : ι₂ -> β), Eq.{succ u1} β (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (Finset.sum.{u1, u2} β ι₁ (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) s₁ (fun (x₁ : ι₁) => f₁ x₁)) (Finset.sum.{u1, u3} β ι₂ (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) s₂ (fun (x₂ : ι₂) => f₂ x₂))) (Finset.sum.{u1, max u2 u3} β (Prod.{u2, u3} ι₁ ι₂) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.product.{u2, u3} ι₁ ι₂ s₁ s₂) (fun (p : Prod.{u2, u3} ι₁ ι₂) => HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (f₁ (Prod.fst.{u2, u3} ι₁ ι₂ p)) (f₂ (Prod.snd.{u2, u3} ι₁ ι₂ p))))
-but is expected to have type
- forall {β : Type.{u3}} [_inst_1 : NonUnitalNonAssocSemiring.{u3} β] {ι₁ : Type.{u2}} {ι₂ : Type.{u1}} (s₁ : Finset.{u2} ι₁) (s₂ : Finset.{u1} ι₂) (f₁ : ι₁ -> β) (f₂ : ι₂ -> β), Eq.{succ u3} β (HMul.hMul.{u3, u3, u3} β β β (instHMul.{u3} β (NonUnitalNonAssocSemiring.toMul.{u3} β _inst_1)) (Finset.sum.{u3, u2} β ι₁ (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β _inst_1) s₁ (fun (x₁ : ι₁) => f₁ x₁)) (Finset.sum.{u3, u1} β ι₂ (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β _inst_1) s₂ (fun (x₂ : ι₂) => f₂ x₂))) (Finset.sum.{u3, max u1 u2} β (Prod.{u2, u1} ι₁ ι₂) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β _inst_1) (Finset.product.{u2, u1} ι₁ ι₂ s₁ s₂) (fun (p : Prod.{u2, u1} ι₁ ι₂) => HMul.hMul.{u3, u3, u3} β β β (instHMul.{u3} β (NonUnitalNonAssocSemiring.toMul.{u3} β _inst_1)) (f₁ (Prod.fst.{u2, u1} ι₁ ι₂ p)) (f₂ (Prod.snd.{u2, u1} ι₁ ι₂ p))))
-Case conversion may be inaccurate. Consider using '#align finset.sum_mul_sum Finset.sum_mul_sumₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
(f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 :=
@@ -95,34 +77,16 @@ section Semiring
variable [NonAssocSemiring β]
-/- warning: finset.sum_mul_boole -> Finset.sum_mul_boole is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : NonAssocSemiring.{u2} β] [_inst_2 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (f : α -> β) (a : α), Eq.{succ u2} β (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)))) (f x) (ite.{succ u2} β (Eq.{succ u1} α a x) (_inst_2 a x) (OfNat.ofNat.{u2} β 1 (OfNat.mk.{u2} β 1 (One.one.{u2} β (AddMonoidWithOne.toOne.{u2} β (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} β (NonAssocSemiring.toAddCommMonoidWithOne.{u2} β _inst_1)))))) (OfNat.ofNat.{u2} β 0 (OfNat.mk.{u2} β 0 (Zero.zero.{u2} β (MulZeroClass.toHasZero.{u2} β (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1))))))))) (ite.{succ u2} β (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) (Finset.decidableMem.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a s) (f a) (OfNat.ofNat.{u2} β 0 (OfNat.mk.{u2} β 0 (Zero.zero.{u2} β (MulZeroClass.toHasZero.{u2} β (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)))))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : NonAssocSemiring.{u2} β] [_inst_2 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (f : α -> β) (a : α), Eq.{succ u2} β (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1))) (f x) (ite.{succ u2} β (Eq.{succ u1} α a x) (_inst_2 a x) (OfNat.ofNat.{u2} β 1 (One.toOfNat1.{u2} β (NonAssocSemiring.toOne.{u2} β _inst_1))) (OfNat.ofNat.{u2} β 0 (Zero.toOfNat0.{u2} β (MulZeroOneClass.toZero.{u2} β (NonAssocSemiring.toMulZeroOneClass.{u2} β _inst_1))))))) (ite.{succ u2} β (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) a s) (Finset.decidableMem.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a s) (f a) (OfNat.ofNat.{u2} β 0 (Zero.toOfNat0.{u2} β (MulZeroOneClass.toZero.{u2} β (NonAssocSemiring.toMulZeroOneClass.{u2} β _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align finset.sum_mul_boole Finset.sum_mul_booleₓ'. -/
theorem sum_mul_boole [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
(∑ x in s, f x * ite (a = x) 1 0) = ite (a ∈ s) (f a) 0 := by simp
#align finset.sum_mul_boole Finset.sum_mul_boole
-/- warning: finset.sum_boole_mul -> Finset.sum_boole_mul is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : NonAssocSemiring.{u2} β] [_inst_2 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (f : α -> β) (a : α), Eq.{succ u2} β (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)))) (ite.{succ u2} β (Eq.{succ u1} α a x) (_inst_2 a x) (OfNat.ofNat.{u2} β 1 (OfNat.mk.{u2} β 1 (One.one.{u2} β (AddMonoidWithOne.toOne.{u2} β (AddCommMonoidWithOne.toAddMonoidWithOne.{u2} β (NonAssocSemiring.toAddCommMonoidWithOne.{u2} β _inst_1)))))) (OfNat.ofNat.{u2} β 0 (OfNat.mk.{u2} β 0 (Zero.zero.{u2} β (MulZeroClass.toHasZero.{u2} β (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1))))))) (f x))) (ite.{succ u2} β (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) (Finset.decidableMem.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a s) (f a) (OfNat.ofNat.{u2} β 0 (OfNat.mk.{u2} β 0 (Zero.zero.{u2} β (MulZeroClass.toHasZero.{u2} β (NonUnitalNonAssocSemiring.toMulZeroClass.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)))))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : NonAssocSemiring.{u2} β] [_inst_2 : DecidableEq.{succ u1} α] (s : Finset.{u1} α) (f : α -> β) (a : α), Eq.{succ u2} β (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1)) s (fun (x : α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β _inst_1))) (ite.{succ u2} β (Eq.{succ u1} α a x) (_inst_2 a x) (OfNat.ofNat.{u2} β 1 (One.toOfNat1.{u2} β (NonAssocSemiring.toOne.{u2} β _inst_1))) (OfNat.ofNat.{u2} β 0 (Zero.toOfNat0.{u2} β (MulZeroOneClass.toZero.{u2} β (NonAssocSemiring.toMulZeroOneClass.{u2} β _inst_1))))) (f x))) (ite.{succ u2} β (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) a s) (Finset.decidableMem.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a s) (f a) (OfNat.ofNat.{u2} β 0 (Zero.toOfNat0.{u2} β (MulZeroOneClass.toZero.{u2} β (NonAssocSemiring.toMulZeroOneClass.{u2} β _inst_1)))))
-Case conversion may be inaccurate. Consider using '#align finset.sum_boole_mul Finset.sum_boole_mulₓ'. -/
theorem sum_boole_mul [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
(∑ x in s, ite (a = x) 1 0 * f x) = ite (a ∈ s) (f a) 0 := by simp
#align finset.sum_boole_mul Finset.sum_boole_mul
end Semiring
-/- warning: finset.sum_div -> Finset.sum_div is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DivisionSemiring.{u2} β] {s : Finset.{u1} α} {f : α -> β} {b : β}, Eq.{succ u2} β (HDiv.hDiv.{u2, u2, u2} β β β (instHDiv.{u2} β (DivInvMonoid.toHasDiv.{u2} β (GroupWithZero.toDivInvMonoid.{u2} β (DivisionSemiring.toGroupWithZero.{u2} β _inst_1)))) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (DivisionSemiring.toSemiring.{u2} β _inst_1)))) s (fun (x : α) => f x)) b) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (DivisionSemiring.toSemiring.{u2} β _inst_1)))) s (fun (x : α) => HDiv.hDiv.{u2, u2, u2} β β β (instHDiv.{u2} β (DivInvMonoid.toHasDiv.{u2} β (GroupWithZero.toDivInvMonoid.{u2} β (DivisionSemiring.toGroupWithZero.{u2} β _inst_1)))) (f x) b))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DivisionSemiring.{u2} β] {s : Finset.{u1} α} {f : α -> β} {b : β}, Eq.{succ u2} β (HDiv.hDiv.{u2, u2, u2} β β β (instHDiv.{u2} β (DivisionSemiring.toDiv.{u2} β _inst_1)) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (DivisionSemiring.toSemiring.{u2} β _inst_1)))) s (fun (x : α) => f x)) b) (Finset.sum.{u2, u1} β α (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (DivisionSemiring.toSemiring.{u2} β _inst_1)))) s (fun (x : α) => HDiv.hDiv.{u2, u2, u2} β β β (instHDiv.{u2} β (DivisionSemiring.toDiv.{u2} β _inst_1)) (f x) b))
-Case conversion may be inaccurate. Consider using '#align finset.sum_div Finset.sum_divₓ'. -/
theorem sum_div [DivisionSemiring β] {s : Finset α} {f : α → β} {b : β} :
(∑ x in s, f x) / b = ∑ x in s, f x / b := by simp only [div_eq_mul_inv, sum_mul]
#align finset.sum_div Finset.sum_div
@@ -131,12 +95,6 @@ section CommSemiring
variable [CommSemiring β]
-/- warning: finset.prod_sum -> Finset.prod_sum is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : CommSemiring.{u2} β] {δ : α -> Type.{u3}} [_inst_2 : DecidableEq.{succ u1} α] [_inst_3 : forall (a : α), DecidableEq.{succ u3} (δ a)] {s : Finset.{u1} α} {t : forall (a : α), Finset.{u3} (δ a)} {f : forall (a : α), (δ a) -> β}, Eq.{succ u2} β (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) s (fun (a : α) => Finset.sum.{u2, u3} β (δ a) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))) (t a) (fun (b : δ a) => f a b))) (Finset.sum.{u2, max u1 u3} β (forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (δ a)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))) (Finset.pi.{u1, u3} α (fun (a : α) => δ a) (fun (a : α) (b : α) => _inst_2 a b) s t) (fun (p : forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (δ a)) => Finset.prod.{u2, u1} β (Subtype.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s)) (CommSemiring.toCommMonoid.{u2} β _inst_1) (Finset.attach.{u1} α s) (fun (x : Subtype.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s)) => f (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) x) (p (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) x) (Subtype.property.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) x)))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u3}} [_inst_1 : CommSemiring.{u3} β] {δ : α -> Type.{u1}} [_inst_2 : DecidableEq.{succ u2} α] [_inst_3 : forall (a : α), DecidableEq.{succ u1} (δ a)] {s : Finset.{u2} α} {t : forall (a : α), Finset.{u1} (δ a)} {f : forall (a : α), (δ a) -> β}, Eq.{succ u3} β (Finset.prod.{u3, u2} β α (CommSemiring.toCommMonoid.{u3} β _inst_1) s (fun (a : α) => Finset.sum.{u3, u1} β (δ a) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} β (Semiring.toNonAssocSemiring.{u3} β (CommSemiring.toSemiring.{u3} β _inst_1)))) (t a) (fun (b : δ a) => f a b))) (Finset.sum.{u3, max u2 u1} β (forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (δ a)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} β (Semiring.toNonAssocSemiring.{u3} β (CommSemiring.toSemiring.{u3} β _inst_1)))) (Finset.pi.{u1, u2} α (fun (a : α) => δ a) (fun (a : α) (b : α) => _inst_2 a b) s t) (fun (p : forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (δ a)) => Finset.prod.{u3, u2} β (Subtype.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s)) (CommSemiring.toCommMonoid.{u3} β _inst_1) (Finset.attach.{u2} α s) (fun (x : Subtype.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s)) => f (Subtype.val.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x) (p (Subtype.val.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x) (Subtype.property.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x)))))
-Case conversion may be inaccurate. Consider using '#align finset.prod_sum Finset.prod_sumₓ'. -/
/-- The product over a sum can be written as a sum over the product of sets, `finset.pi`.
`finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
@@ -173,12 +131,6 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
open Classical
-/- warning: finset.prod_add -> Finset.prod_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : CommSemiring.{u2} β] (f : α -> β) (g : α -> β) (s : Finset.{u1} α), Eq.{succ u2} β (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) s (fun (a : α) => HAdd.hAdd.{u2, u2, u2} β β β (instHAdd.{u2} β (Distrib.toHasAdd.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))))) (f a) (g a))) (Finset.sum.{u2, u1} β (Finset.{u1} α) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))) (Finset.powerset.{u1} α s) (fun (t : Finset.{u1} α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (Distrib.toHasMul.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))))) (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) t (fun (a : α) => f a)) (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Classical.propDecidable (Eq.{succ u1} α a b))) s t) (fun (a : α) => g a))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : CommSemiring.{u2} β] (f : α -> β) (g : α -> β) (s : Finset.{u1} α), Eq.{succ u2} β (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) s (fun (a : α) => HAdd.hAdd.{u2, u2, u2} β β β (instHAdd.{u2} β (Distrib.toAdd.{u2} β (NonUnitalNonAssocSemiring.toDistrib.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))))) (f a) (g a))) (Finset.sum.{u2, u1} β (Finset.{u1} α) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))) (Finset.powerset.{u1} α s) (fun (t : Finset.{u1} α) => HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (NonUnitalNonAssocSemiring.toMul.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1))))) (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) t (fun (a : α) => f a)) (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => Classical.propDecidable (Eq.{succ u1} α a b))) s t) (fun (a : α) => g a))))
-Case conversion may be inaccurate. Consider using '#align finset.prod_add Finset.prod_addₓ'. -/
/-- The product of `f a + g a` over all of `s` is the sum
over the powerset of `s` of the product of `f` over a subset `t` times
the product of `g` over the complement of `t` -/
@@ -224,12 +176,6 @@ theorem prod_add (f g : α → β) (s : Finset α) :
#align finset.prod_add Finset.prod_add
-/- warning: finset.prod_add_ordered -> Finset.prod_add_ordered is a dubious translation:
-lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommSemiring.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (f i) (g i))) (HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (g i) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
-but is expected to have type
- forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommSemiring.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) (f i) (g i))) (HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) (HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) (g i) (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) (f j) (g j)))) (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (j : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) i j) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
-Case conversion may be inaccurate. Consider using '#align finset.prod_add_ordered Finset.prod_add_orderedₓ'. -/
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
(f g : ι → R) :
@@ -253,12 +199,6 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
exact mt (fun ha => (mem_filter.1 ha).1) ha'
#align finset.prod_add_ordered Finset.prod_add_ordered
-/- warning: finset.prod_sub_ordered -> Finset.prod_sub_ordered is a dubious translation:
-lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f i) (g i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (g i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
-but is expected to have type
- forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (f i) (g i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (g i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (f j) (g j)))) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (j : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) i j) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
-Case conversion may be inaccurate. Consider using '#align finset.prod_sub_ordered Finset.prod_sub_orderedₓ'. -/
/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
(∏ i in s, f i - g i) =
@@ -271,12 +211,6 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
simp
#align finset.prod_sub_ordered Finset.prod_sub_ordered
-/- warning: finset.prod_one_sub_ordered -> Finset.prod_one_sub_ordered is a dubious translation:
-lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (f i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f j))))))
-but is expected to have type
- forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (f i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (f j))))))
-Case conversion may be inaccurate. Consider using '#align finset.prod_one_sub_ordered Finset.prod_one_sub_orderedₓ'. -/
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
@@ -284,12 +218,6 @@ theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s :
rw [prod_sub_ordered]; simp
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
-/- warning: finset.sum_pow_mul_eq_add_pow -> Finset.sum_pow_mul_eq_add_pow is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommSemiring.{u2} R] (a : R) (b : R) (s : Finset.{u1} α), Eq.{succ u2} R (Finset.sum.{u2, u1} R (Finset.{u1} α) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))) (Finset.powerset.{u1} α s) (fun (t : Finset.{u1} α) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (HPow.hPow.{u2, 0, u2} R Nat R (instHPow.{u2, 0} R Nat (Monoid.Pow.{u2} R (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2))))) a (Finset.card.{u1} α t)) (HPow.hPow.{u2, 0, u2} R Nat R (instHPow.{u2, 0} R Nat (Monoid.Pow.{u2} R (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2))))) b (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) (Finset.card.{u1} α s) (Finset.card.{u1} α t))))) (HPow.hPow.{u2, 0, u2} R Nat R (instHPow.{u2, 0} R Nat (Monoid.Pow.{u2} R (MonoidWithZero.toMonoid.{u2} R (Semiring.toMonoidWithZero.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2))))) (HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) a b) (Finset.card.{u1} α s))
-but is expected to have type
- forall {α : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommSemiring.{u1} R] (a : R) (b : R) (s : Finset.{u2} α), Eq.{succ u1} R (Finset.sum.{u1, u2} R (Finset.{u2} α) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))) (Finset.powerset.{u2} α s) (fun (t : Finset.{u2} α) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) (HPow.hPow.{u1, 0, u1} R Nat R (instHPow.{u1, 0} R Nat (Monoid.Pow.{u1} R (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) a (Finset.card.{u2} α t)) (HPow.hPow.{u1, 0, u1} R Nat R (instHPow.{u1, 0} R Nat (Monoid.Pow.{u1} R (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) b (HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) (Finset.card.{u2} α s) (Finset.card.{u2} α t))))) (HPow.hPow.{u1, 0, u1} R Nat R (instHPow.{u1, 0} R Nat (Monoid.Pow.{u1} R (MonoidWithZero.toMonoid.{u1} R (Semiring.toMonoidWithZero.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) (HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) a b) (Finset.card.{u2} α s))
-Case conversion may be inaccurate. Consider using '#align finset.sum_pow_mul_eq_add_pow Finset.sum_pow_mul_eq_add_powₓ'. -/
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `finset`
gives `(a + b)^s.card`.-/
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
@@ -319,12 +247,6 @@ section CommRing
variable {R : Type _} [CommRing R]
-/- warning: finset.prod_range_cast_nat_sub -> Finset.prod_range_cast_nat_sub is a dubious translation:
-lean 3 declaration is
- forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (SubNegMonoid.toHasSub.{u1} R (AddGroup.toSubNegMonoid.{u1} R (AddGroupWithOne.toAddGroup.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) n) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) i))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) n i)))
-but is expected to have type
- forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Nat.cast.{u1} R (Semiring.toNatCast.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) n) (Nat.cast.{u1} R (Semiring.toNatCast.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) i))) (Nat.cast.{u1} R (Semiring.toNatCast.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) n i)))
-Case conversion may be inaccurate. Consider using '#align finset.prod_range_cast_nat_sub Finset.prod_range_cast_nat_subₓ'. -/
theorem prod_range_cast_nat_sub (n k : ℕ) :
(∏ i in range k, (n - i : R)) = (∏ i in range k, n - i : ℕ) :=
by
@@ -337,12 +259,6 @@ theorem prod_range_cast_nat_sub (n k : ℕ) :
end CommRing
-/- warning: finset.prod_powerset_insert -> Finset.prod_powerset_insert is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : CommMonoid.{u2} β] {s : Finset.{u1} α} {x : α}, (Not (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s)) -> (forall (f : (Finset.{u1} α) -> β), Eq.{succ u2} β (Finset.prod.{u2, u1} β (Finset.{u1} α) _inst_2 (Finset.powerset.{u1} α (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) x s)) (fun (a : Finset.{u1} α) => f a)) (HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (MulOneClass.toHasMul.{u2} β (Monoid.toMulOneClass.{u2} β (CommMonoid.toMonoid.{u2} β _inst_2)))) (Finset.prod.{u2, u1} β (Finset.{u1} α) _inst_2 (Finset.powerset.{u1} α s) (fun (a : Finset.{u1} α) => f a)) (Finset.prod.{u2, u1} β (Finset.{u1} α) _inst_2 (Finset.powerset.{u1} α s) (fun (t : Finset.{u1} α) => f (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.hasInsert.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) x t)))))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : DecidableEq.{succ u1} α] [_inst_2 : CommMonoid.{u2} β] {s : Finset.{u1} α} {x : α}, (Not (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s)) -> (forall (f : (Finset.{u1} α) -> β), Eq.{succ u2} β (Finset.prod.{u2, u1} β (Finset.{u1} α) _inst_2 (Finset.powerset.{u1} α (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.instInsertFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) x s)) (fun (a : Finset.{u1} α) => f a)) (HMul.hMul.{u2, u2, u2} β β β (instHMul.{u2} β (MulOneClass.toMul.{u2} β (Monoid.toMulOneClass.{u2} β (CommMonoid.toMonoid.{u2} β _inst_2)))) (Finset.prod.{u2, u1} β (Finset.{u1} α) _inst_2 (Finset.powerset.{u1} α s) (fun (a : Finset.{u1} α) => f a)) (Finset.prod.{u2, u1} β (Finset.{u1} α) _inst_2 (Finset.powerset.{u1} α s) (fun (t : Finset.{u1} α) => f (Insert.insert.{u1, u1} α (Finset.{u1} α) (Finset.instInsertFinset.{u1} α (fun (a : α) (b : α) => _inst_1 a b)) x t)))))
-Case conversion may be inaccurate. Consider using '#align finset.prod_powerset_insert Finset.prod_powerset_insertₓ'. -/
/-- A product over all subsets of `s ∪ {x}` is obtained by multiplying the product over all subsets
of `s`, and over all subsets of `s` to which one adds `x`. -/
@[to_additive
@@ -376,12 +292,6 @@ theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
#align finset.sum_powerset Finset.sum_powerset
-/
-/- warning: finset.sum_range_succ_mul_sum_range_succ -> Finset.sum_range_succ_mul_sum_range_succ is a dubious translation:
-lean 3 declaration is
- forall {β : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} β] (n : Nat) (k : Nat) (f : Nat -> β) (g : Nat -> β), Eq.{succ u1} β (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) n (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (i : Nat) => f i)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) k (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))) (fun (i : Nat) => g i))) (HAdd.hAdd.{u1, u1, u1} β β β (instHAdd.{u1} β (Distrib.toHasAdd.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (HAdd.hAdd.{u1, u1, u1} β β β (instHAdd.{u1} β (Distrib.toHasAdd.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (HAdd.hAdd.{u1, u1, u1} β β β (instHAdd.{u1} β (Distrib.toHasAdd.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range n) (fun (i : Nat) => f i)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range k) (fun (i : Nat) => g i))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (f n) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range k) (fun (i : Nat) => g i)))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range n) (fun (i : Nat) => f i)) (g k))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (Distrib.toHasMul.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (f n) (g k)))
-but is expected to have type
- forall {β : Type.{u1}} [_inst_1 : NonUnitalNonAssocSemiring.{u1} β] (n : Nat) (k : Nat) (f : Nat -> β) (g : Nat -> β), Eq.{succ u1} β (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (NonUnitalNonAssocSemiring.toMul.{u1} β _inst_1)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) n (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (i : Nat) => f i)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) k (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))) (fun (i : Nat) => g i))) (HAdd.hAdd.{u1, u1, u1} β β β (instHAdd.{u1} β (Distrib.toAdd.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (HAdd.hAdd.{u1, u1, u1} β β β (instHAdd.{u1} β (Distrib.toAdd.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (HAdd.hAdd.{u1, u1, u1} β β β (instHAdd.{u1} β (Distrib.toAdd.{u1} β (NonUnitalNonAssocSemiring.toDistrib.{u1} β _inst_1))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (NonUnitalNonAssocSemiring.toMul.{u1} β _inst_1)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range n) (fun (i : Nat) => f i)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range k) (fun (i : Nat) => g i))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (NonUnitalNonAssocSemiring.toMul.{u1} β _inst_1)) (f n) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range k) (fun (i : Nat) => g i)))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (NonUnitalNonAssocSemiring.toMul.{u1} β _inst_1)) (Finset.sum.{u1, 0} β Nat (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} β _inst_1) (Finset.range n) (fun (i : Nat) => f i)) (g k))) (HMul.hMul.{u1, u1, u1} β β β (instHMul.{u1} β (NonUnitalNonAssocSemiring.toMul.{u1} β _inst_1)) (f n) (g k)))
-Case conversion may be inaccurate. Consider using '#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succₓ'. -/
theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k : ℕ) (f g : ℕ → β) :
((∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i) =
(((∑ i in range n, f i) * ∑ i in range k, g i) + f n * ∑ i in range k, g i) +
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -86,10 +86,7 @@ Case conversion may be inaccurate. Consider using '#align finset.sum_mul_sum Fin
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
(f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 :=
- by
- rw [sum_product, sum_mul, sum_congr rfl]
- intros
- rw [mul_sum]
+ by rw [sum_product, sum_mul, sum_congr rfl]; intros ; rw [mul_sum]
#align finset.sum_mul_sum Finset.sum_mul_sum
end Semiring
@@ -147,8 +144,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
(∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) :=
by
induction' s using Finset.induction with a s ha ih
- · rw [pi_empty, sum_singleton]
- rfl
+ · rw [pi_empty, sum_singleton]; rfl
· have h₁ :
∀ x ∈ t a,
∀ y ∈ t a,
@@ -169,13 +165,10 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
refine' sum_congr rfl fun g _ => _
rw [attach_insert, prod_insert, prod_image]
· simp only [pi.cons_same]
- congr with ⟨v, hv⟩
- congr
+ congr with ⟨v, hv⟩; congr
exact (pi.cons_ne (by rintro rfl <;> exact ha hv)).symm
· exact fun _ _ _ _ => Subtype.eq ∘ Subtype.mk.inj
- · simp only [mem_image]
- rintro ⟨⟨_, hm⟩, _, rfl⟩
- exact ha hm
+ · simp only [mem_image]; rintro ⟨⟨_, hm⟩, _, rfl⟩; exact ha hm
#align finset.prod_sum Finset.prod_sum
open Classical
@@ -246,14 +239,11 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
(g i * ∏ j in s.filterₓ (· < i), f j + g j) * ∏ j in s.filterₓ fun j => i < j, f j :=
by
refine' Finset.induction_on_max s (by simp) _
- clear s
- intro a s ha ihs
+ clear s; intro a s ha ihs
have ha' : a ∉ s := fun ha' => (ha a ha').False
rw [prod_insert ha', prod_insert ha', sum_insert ha', filter_insert, if_neg (lt_irrefl a),
filter_true_of_mem ha, ihs, add_mul, mul_add, mul_add, add_assoc]
- congr 1
- rw [add_comm]
- congr 1
+ congr 1; rw [add_comm]; congr 1
· rw [filter_false_of_mem, prod_empty, mul_one]
exact (forall_mem_insert _ _ _).2 ⟨lt_irrefl a, fun i hi => (ha i hi).not_lt⟩
· rw [mul_sum]
@@ -290,10 +280,8 @@ Case conversion may be inaccurate. Consider using '#align finset.prod_one_sub_or
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
- (f : ι → R) : (∏ i in s, 1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filterₓ (· < i), 1 - f j :=
- by
- rw [prod_sub_ordered]
- simp
+ (f : ι → R) : (∏ i in s, 1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filterₓ (· < i), 1 - f j := by
+ rw [prod_sub_ordered]; simp
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
/- warning: finset.sum_pow_mul_eq_add_pow -> Finset.sum_pow_mul_eq_add_pow is a dubious translation:
mathlib commit https://github.com/leanprover-community/mathlib/commit/75e7fca56381d056096ce5d05e938f63a6567828
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
! This file was ported from Lean 3 source module algebra.big_operators.ring
-! leanprover-community/mathlib commit 327c3c0d9232d80e250dc8f65e7835b82b266ea5
+! leanprover-community/mathlib commit b2c89893177f66a48daf993b7ba5ef7cddeff8c9
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -164,7 +164,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_bUnion h₁]
refine' sum_congr rfl fun b _ => _
have h₂ : ∀ p₁ ∈ pi s t, ∀ p₂ ∈ pi s t, pi.cons s a b p₁ = pi.cons s a b p₂ → p₁ = p₂ :=
- fun p₁ h₁ p₂ h₂ eq => pi_cons_injective ha Eq
+ fun p₁ h₁ p₂ h₂ eq => pi.cons_injective ha Eq
rw [sum_image h₂, mul_sum]
refine' sum_congr rfl fun g _ => _
rw [attach_insert, prod_insert, prod_image]
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -233,7 +233,7 @@ theorem prod_add (f g : α → β) (s : Finset α) :
/- warning: finset.prod_add_ordered -> Finset.prod_add_ordered is a dubious translation:
lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommSemiring.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (f i) (g i))) (HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (g i) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
+ forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommSemiring.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (f i) (g i))) (HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (g i) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HAdd.hAdd.{u2, u2, u2} R R R (instHAdd.{u2} R (Distrib.toHasAdd.{u2} R (NonUnitalNonAssocSemiring.toDistrib.{u2} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} R (Semiring.toNonAssocSemiring.{u2} R (CommSemiring.toSemiring.{u2} R _inst_2)))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommSemiring.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
but is expected to have type
forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommSemiring.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) (f i) (g i))) (HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) (HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2))))) (g i) (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HAdd.hAdd.{u1, u1, u1} R R R (instHAdd.{u1} R (Distrib.toAdd.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_2)))))) (f j) (g j)))) (Finset.prod.{u1, u2} R ι (CommSemiring.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (j : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) i j) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
Case conversion may be inaccurate. Consider using '#align finset.prod_add_ordered Finset.prod_add_orderedₓ'. -/
@@ -265,7 +265,7 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
/- warning: finset.prod_sub_ordered -> Finset.prod_sub_ordered is a dubious translation:
lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f i) (g i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (g i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
+ forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f i) (g i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (g i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
but is expected to have type
forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (f i) (g i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (g i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (f j) (g j)))) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (j : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) i j) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
Case conversion may be inaccurate. Consider using '#align finset.prod_sub_ordered Finset.prod_sub_orderedₓ'. -/
@@ -283,7 +283,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
/- warning: finset.prod_one_sub_ordered -> Finset.prod_one_sub_ordered is a dubious translation:
lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (f i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f j))))))
+ forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (f i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toHasLt.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f j))))))
but is expected to have type
forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (f i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (f j))))))
Case conversion may be inaccurate. Consider using '#align finset.prod_one_sub_ordered Finset.prod_one_sub_orderedₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/08e1d8d4d989df3a6df86f385e9053ec8a372cc1
@@ -285,7 +285,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
lean 3 declaration is
forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (f i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f j))))))
but is expected to have type
- forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (NonAssocRing.toOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (NonAssocRing.toOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (NonAssocRing.toOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f j))))))
+ forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (f i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_2))))) (f j))))))
Case conversion may be inaccurate. Consider using '#align finset.prod_one_sub_ordered Finset.prod_one_sub_orderedₓ'. -/
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
@@ -335,7 +335,7 @@ variable {R : Type _} [CommRing R]
lean 3 declaration is
forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (SubNegMonoid.toHasSub.{u1} R (AddGroup.toSubNegMonoid.{u1} R (AddGroupWithOne.toAddGroup.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) n) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) i))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) n i)))
but is expected to have type
- forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) n) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) i))) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) n i)))
+ forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Nat.cast.{u1} R (Semiring.toNatCast.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) n) (Nat.cast.{u1} R (Semiring.toNatCast.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) i))) (Nat.cast.{u1} R (Semiring.toNatCast.{u1} R (CommSemiring.toSemiring.{u1} R (CommRing.toCommSemiring.{u1} R _inst_1))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) n i)))
Case conversion may be inaccurate. Consider using '#align finset.prod_range_cast_nat_sub Finset.prod_range_cast_nat_subₓ'. -/
theorem prod_range_cast_nat_sub (n k : ℕ) :
(∏ i in range k, (n - i : R)) = (∏ i in range k, n - i : ℕ) :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce86f4e05e9a9b8da5e316b22c76ce76440c56a1
@@ -265,7 +265,7 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
/- warning: finset.prod_sub_ordered -> Finset.prod_sub_ordered is a dubious translation:
lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f i) (g i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (g i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
+ forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f i) (g i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (g i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (f j) (g j)))) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (j : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) i j) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
but is expected to have type
forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R) (g : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (f i) (g i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => f i)) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (g i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (f j) (g j)))) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (j : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) i j) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 i a) s) (fun (j : ι) => f j)))))
Case conversion may be inaccurate. Consider using '#align finset.prod_sub_ordered Finset.prod_sub_orderedₓ'. -/
@@ -283,7 +283,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
/- warning: finset.prod_one_sub_ordered -> Finset.prod_one_sub_ordered is a dubious translation:
lean 3 declaration is
- forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (f i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (NonAssocRing.toAddGroupWithOne.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f j))))))
+ forall {ι : Type.{u1}} {R : Type.{u2}} [_inst_2 : CommRing.{u2} R] [_inst_3 : LinearOrder.{u1} ι] (s : Finset.{u1} ι) (f : ι -> R), Eq.{succ u2} R (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) s (fun (i : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f i))) (HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (Finset.sum.{u2, u1} R ι (AddCommGroup.toAddCommMonoid.{u2} R (NonUnitalNonAssocRing.toAddCommGroup.{u2} R (NonAssocRing.toNonUnitalNonAssocRing.{u2} R (Ring.toNonAssocRing.{u2} R (CommRing.toRing.{u2} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u2, u2, u2} R R R (instHMul.{u2} R (Distrib.toHasMul.{u2} R (Ring.toDistrib.{u2} R (CommRing.toRing.{u2} R _inst_2)))) (f i) (Finset.prod.{u2, u1} R ι (CommRing.toCommMonoid.{u2} R _inst_2) (Finset.filter.{u1} ι (fun (_x : ι) => LT.lt.{u1} ι (Preorder.toLT.{u1} ι (PartialOrder.toPreorder.{u1} ι (SemilatticeInf.toPartialOrder.{u1} ι (Lattice.toSemilatticeInf.{u1} ι (LinearOrder.toLattice.{u1} ι _inst_3))))) _x i) (fun (a : ι) => LT.lt.decidable.{u1} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u2, u2, u2} R R R (instHSub.{u2} R (SubNegMonoid.toHasSub.{u2} R (AddGroup.toSubNegMonoid.{u2} R (AddGroupWithOne.toAddGroup.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2))))))) (OfNat.ofNat.{u2} R 1 (OfNat.mk.{u2} R 1 (One.one.{u2} R (AddMonoidWithOne.toOne.{u2} R (AddGroupWithOne.toAddMonoidWithOne.{u2} R (AddCommGroupWithOne.toAddGroupWithOne.{u2} R (Ring.toAddCommGroupWithOne.{u2} R (CommRing.toRing.{u2} R _inst_2)))))))) (f j))))))
but is expected to have type
forall {ι : Type.{u2}} {R : Type.{u1}} [_inst_2 : CommRing.{u1} R] [_inst_3 : LinearOrder.{u2} ι] (s : Finset.{u2} ι) (f : ι -> R), Eq.{succ u1} R (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) s (fun (i : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (NonAssocRing.toOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i))) (HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (NonAssocRing.toOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (Finset.sum.{u1, u2} R ι (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonUnitalNonAssocRing.toNonUnitalNonAssocSemiring.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) s (fun (i : ι) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocRing.toMul.{u1} R (NonAssocRing.toNonUnitalNonAssocRing.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f i) (Finset.prod.{u1, u2} R ι (CommRing.toCommMonoid.{u1} R _inst_2) (Finset.filter.{u2} ι (fun (_x : ι) => LT.lt.{u2} ι (Preorder.toLT.{u2} ι (PartialOrder.toPreorder.{u2} ι (SemilatticeInf.toPartialOrder.{u2} ι (Lattice.toSemilatticeInf.{u2} ι (DistribLattice.toLattice.{u2} ι (instDistribLattice.{u2} ι _inst_3)))))) _x i) (fun (a : ι) => instDecidableLtToLTToPreorderToPartialOrder.{u2} ι _inst_3 a i) s) (fun (j : ι) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_2))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (NonAssocRing.toOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_2))))) (f j))))))
Case conversion may be inaccurate. Consider using '#align finset.prod_one_sub_ordered Finset.prod_one_sub_orderedₓ'. -/
@@ -333,7 +333,7 @@ variable {R : Type _} [CommRing R]
/- warning: finset.prod_range_cast_nat_sub -> Finset.prod_range_cast_nat_sub is a dubious translation:
lean 3 declaration is
- forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (SubNegMonoid.toHasSub.{u1} R (AddGroup.toSubNegMonoid.{u1} R (AddGroupWithOne.toAddGroup.{u1} R (NonAssocRing.toAddGroupWithOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (NonAssocRing.toAddGroupWithOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) n) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (NonAssocRing.toAddGroupWithOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) i))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (NonAssocRing.toAddGroupWithOne.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) n i)))
+ forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (SubNegMonoid.toHasSub.{u1} R (AddGroup.toSubNegMonoid.{u1} R (AddGroupWithOne.toAddGroup.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1))))))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) n) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) i))) ((fun (a : Type) (b : Type.{u1}) [self : HasLiftT.{1, succ u1} a b] => self.0) Nat R (HasLiftT.mk.{1, succ u1} Nat R (CoeTCₓ.coe.{1, succ u1} Nat R (Nat.castCoe.{u1} R (AddMonoidWithOne.toNatCast.{u1} R (AddGroupWithOne.toAddMonoidWithOne.{u1} R (AddCommGroupWithOne.toAddGroupWithOne.{u1} R (Ring.toAddCommGroupWithOne.{u1} R (CommRing.toRing.{u1} R _inst_1)))))))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat Nat.hasSub) n i)))
but is expected to have type
forall {R : Type.{u1}} [_inst_1 : CommRing.{u1} R] (n : Nat) (k : Nat), Eq.{succ u1} R (Finset.prod.{u1, 0} R Nat (CommRing.toCommMonoid.{u1} R _inst_1) (Finset.range k) (fun (i : Nat) => HSub.hSub.{u1, u1, u1} R R R (instHSub.{u1} R (Ring.toSub.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) n) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) i))) (Nat.cast.{u1} R (NonAssocRing.toNatCast.{u1} R (Ring.toNonAssocRing.{u1} R (CommRing.toRing.{u1} R _inst_1))) (Finset.prod.{0, 0} Nat Nat Nat.commMonoid (Finset.range k) (fun (i : Nat) => HSub.hSub.{0, 0, 0} Nat Nat Nat (instHSub.{0} Nat instSubNat) n i)))
Case conversion may be inaccurate. Consider using '#align finset.prod_range_cast_nat_sub Finset.prod_range_cast_nat_subₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/1f4705ccdfe1e557fc54a0ce081a05e33d2e6240
@@ -138,7 +138,7 @@ variable [CommSemiring β]
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : CommSemiring.{u2} β] {δ : α -> Type.{u3}} [_inst_2 : DecidableEq.{succ u1} α] [_inst_3 : forall (a : α), DecidableEq.{succ u3} (δ a)] {s : Finset.{u1} α} {t : forall (a : α), Finset.{u3} (δ a)} {f : forall (a : α), (δ a) -> β}, Eq.{succ u2} β (Finset.prod.{u2, u1} β α (CommSemiring.toCommMonoid.{u2} β _inst_1) s (fun (a : α) => Finset.sum.{u2, u3} β (δ a) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))) (t a) (fun (b : δ a) => f a b))) (Finset.sum.{u2, max u1 u3} β (forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (δ a)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u2} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u2} β (Semiring.toNonAssocSemiring.{u2} β (CommSemiring.toSemiring.{u2} β _inst_1)))) (Finset.pi.{u1, u3} α (fun (a : α) => δ a) (fun (a : α) (b : α) => _inst_2 a b) s t) (fun (p : forall (a : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) a s) -> (δ a)) => Finset.prod.{u2, u1} β (Subtype.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s)) (CommSemiring.toCommMonoid.{u2} β _inst_1) (Finset.attach.{u1} α s) (fun (x : Subtype.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s)) => f (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) x) (p (Subtype.val.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) x) (Subtype.property.{succ u1} α (fun (x : α) => Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) x)))))
but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u3}} [_inst_1 : CommSemiring.{u3} β] {δ : α -> Type.{u1}} [_inst_2 : DecidableEq.{succ u2} α] [_inst_3 : forall (a : α), DecidableEq.{succ u1} (δ a)] {s : Finset.{u2} α} {t : forall (a : α), Finset.{u1} (δ a)} {f : forall (a : α), (δ a) -> β}, Eq.{succ u3} β (Finset.prod.{u3, u2} β α (CommSemiring.toCommMonoid.{u3} β _inst_1) s (fun (a : α) => Finset.sum.{u3, u1} β (δ a) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} β (Semiring.toNonAssocSemiring.{u3} β (CommSemiring.toSemiring.{u3} β _inst_1)))) (t a) (fun (b : δ a) => f a b))) (Finset.sum.{u3, max u2 u1} β (forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (δ a)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} β (Semiring.toNonAssocSemiring.{u3} β (CommSemiring.toSemiring.{u3} β _inst_1)))) (Finset.pi.{u2, u1} α (fun (a : α) => δ a) (fun (a : α) (b : α) => _inst_2 a b) s t) (fun (p : forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (δ a)) => Finset.prod.{u3, u2} β (Subtype.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s)) (CommSemiring.toCommMonoid.{u3} β _inst_1) (Finset.attach.{u2} α s) (fun (x : Subtype.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s)) => f (Subtype.val.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x) (p (Subtype.val.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x) (Subtype.property.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x)))))
+ forall {α : Type.{u2}} {β : Type.{u3}} [_inst_1 : CommSemiring.{u3} β] {δ : α -> Type.{u1}} [_inst_2 : DecidableEq.{succ u2} α] [_inst_3 : forall (a : α), DecidableEq.{succ u1} (δ a)] {s : Finset.{u2} α} {t : forall (a : α), Finset.{u1} (δ a)} {f : forall (a : α), (δ a) -> β}, Eq.{succ u3} β (Finset.prod.{u3, u2} β α (CommSemiring.toCommMonoid.{u3} β _inst_1) s (fun (a : α) => Finset.sum.{u3, u1} β (δ a) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} β (Semiring.toNonAssocSemiring.{u3} β (CommSemiring.toSemiring.{u3} β _inst_1)))) (t a) (fun (b : δ a) => f a b))) (Finset.sum.{u3, max u2 u1} β (forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (δ a)) (NonUnitalNonAssocSemiring.toAddCommMonoid.{u3} β (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u3} β (Semiring.toNonAssocSemiring.{u3} β (CommSemiring.toSemiring.{u3} β _inst_1)))) (Finset.pi.{u1, u2} α (fun (a : α) => δ a) (fun (a : α) (b : α) => _inst_2 a b) s t) (fun (p : forall (a : α), (Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) a s) -> (δ a)) => Finset.prod.{u3, u2} β (Subtype.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s)) (CommSemiring.toCommMonoid.{u3} β _inst_1) (Finset.attach.{u2} α s) (fun (x : Subtype.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s)) => f (Subtype.val.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x) (p (Subtype.val.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x) (Subtype.property.{succ u2} α (fun (x : α) => Membership.mem.{u2, u2} α (Finset.{u2} α) (Finset.instMembershipFinset.{u2} α) x s) x)))))
Case conversion may be inaccurate. Consider using '#align finset.prod_sum Finset.prod_sumₓ'. -/
/-- The product over a sum can be written as a sum over the product of sets, `finset.pi`.
`finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -170,11 +170,11 @@ lemma prod_univ_sum [Fintype ι] (t : ∀ i, Finset (κ i)) (f : ∀ i, κ i →
lemma sum_prod_piFinset {κ : Type*} [Fintype ι] (s : Finset κ) (g : ι → κ → α) :
∑ f in piFinset fun _ : ι ↦ s, ∏ i, g i (f i) = ∏ i, ∑ j in s, g i j := by
- classical rw [← prod_univ_sum]
+ rw [← prod_univ_sum]
lemma sum_pow' (s : Finset ι) (f : ι → α) (n : ℕ) :
(∑ a in s, f a) ^ n = ∑ p in piFinset fun _i : Fin n ↦ s, ∏ i, f (p i) := by
- classical convert @prod_univ_sum (Fin n) _ _ _ _ _ (fun _i ↦ s) fun _i d ↦ f d; simp
+ convert @prod_univ_sum (Fin n) _ _ _ _ _ (fun _i ↦ s) fun _i d ↦ f d; simp
/-- The product of `f a + g a` over all of `s` is the sum over the powerset of `s` of the product of
`f` over a subset `t` times the product of `g` over the complement of `t` -/
@@ -297,7 +297,31 @@ lemma sum_div (s : Finset ι) (f : ι → α) (a : α) :
end DivisionSemiring
end Finset
+open Finset
+
+namespace Fintype
+variable {ι κ α : Type*} [DecidableEq ι] [Fintype ι] [Fintype κ] [CommSemiring α]
+
+lemma sum_pow (f : ι → α) (n : ℕ) : (∑ a, f a) ^ n = ∑ p : Fin n → ι, ∏ i, f (p i) := by
+ simp [sum_pow']
+
+lemma sum_mul_sum (f : ι → α) (g : κ → α) : (∑ i, f i) * ∑ j, g j = ∑ i, ∑ j, f i * g j :=
+ Finset.sum_mul_sum _ _ _ _
+
+lemma prod_add (f g : ι → α) : ∏ a, (f a + g a) = ∑ t, (∏ a in t, f a) * ∏ a in tᶜ, g a := by
+ simpa [compl_eq_univ_sdiff] using Finset.prod_add f g univ
+
+end Fintype
+
namespace Nat
+variable {ι : Type*} {s : Finset ι} {f : ι → ℕ} {n : ℕ}
+
+protected lemma sum_div (hf : ∀ i ∈ s, n ∣ f i) : (∑ i in s, f i) / n = ∑ i in s, f i / n := by
+ obtain rfl | hn := n.eq_zero_or_pos
+ · simp
+ rw [Nat.div_eq_iff_eq_mul_left hn (dvd_sum hf), sum_mul]
+ refine' sum_congr rfl fun s hs ↦ _
+ rw [Nat.div_mul_cancel (hf _ hs)]
@[simp, norm_cast]
lemma cast_list_sum [AddMonoidWithOne β] (s : List ℕ) : (↑s.sum : β) = (s.map (↑)).sum :=
@@ -6,7 +6,6 @@ Authors: Johannes Hölzl
import Mathlib.Algebra.BigOperators.Basic
import Mathlib.Algebra.BigOperators.Multiset.Lemmas
import Mathlib.Algebra.Field.Defs
-import Mathlib.Algebra.Ring.Opposite
import Mathlib.Data.Fintype.Powerset
import Mathlib.Data.Int.Cast.Lemmas
@@ -24,57 +23,17 @@ open scoped BigOperators
variable {ι α β γ : Type*} {κ : ι → Type*} {s s₁ s₂ : Finset ι} {i : ι} {a : α} {f g : ι → α}
-section Deprecated
-
-#align monoid_hom.map_prod map_prodₓ
-#align add_monoid_hom.map_sum map_sumₓ
-#align mul_equiv.map_prod map_prodₓ
-#align add_equiv.map_sum map_sumₓ
-
-@[deprecated _root_.map_list_prod]
-protected lemma RingHom.map_list_prod [Semiring β] [Semiring γ] (f : β →+* γ) (l : List β) :
- f l.prod = (l.map f).prod :=
- map_list_prod f l
-#align ring_hom.map_list_prod RingHom.map_list_prod
-
-@[deprecated _root_.map_list_sum]
-protected lemma RingHom.map_list_sum [NonAssocSemiring β] [NonAssocSemiring γ] (f : β →+* γ)
- (l : List β) : f l.sum = (l.map f).sum :=
- map_list_sum f l
-#align ring_hom.map_list_sum RingHom.map_list_sum
-
-/-- A morphism into the opposite ring acts on the product by acting on the reversed elements. -/
-@[deprecated _root_.unop_map_list_prod]
-protected lemma RingHom.unop_map_list_prod [Semiring β] [Semiring γ] (f : β →+* γᵐᵒᵖ)
- (l : List β) : MulOpposite.unop (f l.prod) = (l.map (MulOpposite.unop ∘ f)).reverse.prod :=
- unop_map_list_prod f l
-#align ring_hom.unop_map_list_prod RingHom.unop_map_list_prod
-
-@[deprecated _root_.map_multiset_prod]
-protected lemma RingHom.map_multiset_prod [CommSemiring β] [CommSemiring γ] (f : β →+* γ)
- (s : Multiset β) : f s.prod = (s.map f).prod :=
- map_multiset_prod f s
-#align ring_hom.map_multiset_prod RingHom.map_multiset_prod
-
-@[deprecated _root_.map_multiset_sum]
-protected lemma RingHom.map_multiset_sum [NonAssocSemiring β] [NonAssocSemiring γ] (f : β →+* γ)
- (s : Multiset β) : f s.sum = (s.map f).sum :=
- map_multiset_sum f s
-#align ring_hom.map_multiset_sum RingHom.map_multiset_sum
-
-@[deprecated _root_.map_prod]
-protected lemma RingHom.map_prod [CommSemiring β] [CommSemiring γ] (g : β →+* γ) (f : α → β)
- (s : Finset α) : g (∏ x in s, f x) = ∏ x in s, g (f x) :=
- map_prod g f s
-#align ring_hom.map_prod RingHom.map_prod
-
-@[deprecated _root_.map_sum]
-protected lemma RingHom.map_sum [NonAssocSemiring β] [NonAssocSemiring γ] (g : β →+* γ)
- (f : α → β) (s : Finset α) : g (∑ x in s, f x) = ∑ x in s, g (f x) :=
- map_sum g f s
-#align ring_hom.map_sum RingHom.map_sum
-
-end Deprecated
+#align monoid_hom.map_prod map_prod
+#align add_monoid_hom.map_sum map_sum
+#align mul_equiv.map_prod map_prod
+#align add_equiv.map_sum map_sum
+#align ring_hom.map_list_prod map_list_prod
+#align ring_hom.map_list_sum map_list_sum
+#align ring_hom.unop_map_list_prod unop_map_list_prod
+#align ring_hom.map_multiset_prod map_multiset_prod
+#align ring_hom.map_multiset_sum map_multiset_sum
+#align ring_hom.map_prod map_prod
+#align ring_hom.map_sum map_sum
namespace Finset
Purely automatic replacement. If this is in any way controversial; I'm happy to just close this PR.
@@ -270,7 +270,7 @@ theorem prod_add_ordered [LinearOrder ι] [CommSemiring α] (s : Finset ι) (f g
#align finset.prod_add_ordered Finset.prod_add_ordered
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `Finset`
-gives `(a + b)^s.card`.-/
+gives `(a + b)^s.card`. -/
theorem sum_pow_mul_eq_add_pow (a b : α) (s : Finset ι) :
(∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
classical
Take the content of
Algebra.BigOperators.List.Basic
Algebra.BigOperators.List.Lemmas
Algebra.BigOperators.Multiset.Basic
Algebra.BigOperators.Multiset.Lemmas
Algebra.BigOperators.Multiset.Order
Algebra.BigOperators.Order
and sort it into six files:
Algebra.Order.BigOperators.Group.List
. I credit Yakov for https://github.com/leanprover-community/mathlib/pull/8543.Algebra.Order.BigOperators.Group.Multiset
. Copyright inherited from Algebra.BigOperators.Multiset.Order
.Algebra.Order.BigOperators.Group.Finset
. Copyright inherited from Algebra.BigOperators.Order
.Algebra.Order.BigOperators.Ring.List
. I credit Stuart for https://github.com/leanprover-community/mathlib/pull/10184.Algebra.Order.BigOperators.Ring.Multiset
. I credit Ruben for https://github.com/leanprover-community/mathlib/pull/8787.Algebra.Order.BigOperators.Ring.Finset
. I credit Floris for https://github.com/leanprover-community/mathlib/pull/1294.Here are the design decisions at play:
Data.Nat.Order.Basic
in a few List
files.Algebra.Order.BigOperators
instead of Algebra.BigOperators.Order
because algebraic order theory is more of a theory than big operators algebra. Another reason is that algebraic order theory is the only way to mix pure order and pure algebra, while there are more ways to mix pure finiteness and pure algebra than just big operators.Algebra.Order.BigOperators.Group
should be additivisable (except a few Nat
- or Int
-specific lemmas). In contrast, things under Algebra.Order.BigOperators.Ring
are more prone to having heavy imports.List
vs Multiset
vs Finset
. This is not strictly necessary, and can be relaxed in cases where there aren't that many lemmas to be had. As an example, I could split out the AbsoluteValue
lemmas from Algebra.Order.BigOperators.Ring.Finset
to a file Algebra.Order.BigOperators.Ring.AbsoluteValue
and it could stay this way until too many lemmas are in this file (or a split is needed for import reasons), in which case we would need files Algebra.Order.BigOperators.Ring.AbsoluteValue.Finset
, Algebra.Order.BigOperators.Ring.AbsoluteValue.Multiset
, etc...Finsupp
big operator and finprod
/finsum
order lemmas also belong in Algebra.Order.BigOperators
. I haven't done so in this PR because the diff is big enough like that.@@ -4,8 +4,11 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
-/
import Mathlib.Algebra.BigOperators.Basic
+import Mathlib.Algebra.BigOperators.Multiset.Lemmas
import Mathlib.Algebra.Field.Defs
+import Mathlib.Algebra.Ring.Opposite
import Mathlib.Data.Fintype.Powerset
+import Mathlib.Data.Int.Cast.Lemmas
#align_import algebra.big_operators.ring from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
@@ -19,8 +22,76 @@ multiplicative and additive structures on the values being combined.
open Fintype
open scoped BigOperators
+variable {ι α β γ : Type*} {κ : ι → Type*} {s s₁ s₂ : Finset ι} {i : ι} {a : α} {f g : ι → α}
+
+section Deprecated
+
+#align monoid_hom.map_prod map_prodₓ
+#align add_monoid_hom.map_sum map_sumₓ
+#align mul_equiv.map_prod map_prodₓ
+#align add_equiv.map_sum map_sumₓ
+
+@[deprecated _root_.map_list_prod]
+protected lemma RingHom.map_list_prod [Semiring β] [Semiring γ] (f : β →+* γ) (l : List β) :
+ f l.prod = (l.map f).prod :=
+ map_list_prod f l
+#align ring_hom.map_list_prod RingHom.map_list_prod
+
+@[deprecated _root_.map_list_sum]
+protected lemma RingHom.map_list_sum [NonAssocSemiring β] [NonAssocSemiring γ] (f : β →+* γ)
+ (l : List β) : f l.sum = (l.map f).sum :=
+ map_list_sum f l
+#align ring_hom.map_list_sum RingHom.map_list_sum
+
+/-- A morphism into the opposite ring acts on the product by acting on the reversed elements. -/
+@[deprecated _root_.unop_map_list_prod]
+protected lemma RingHom.unop_map_list_prod [Semiring β] [Semiring γ] (f : β →+* γᵐᵒᵖ)
+ (l : List β) : MulOpposite.unop (f l.prod) = (l.map (MulOpposite.unop ∘ f)).reverse.prod :=
+ unop_map_list_prod f l
+#align ring_hom.unop_map_list_prod RingHom.unop_map_list_prod
+
+@[deprecated _root_.map_multiset_prod]
+protected lemma RingHom.map_multiset_prod [CommSemiring β] [CommSemiring γ] (f : β →+* γ)
+ (s : Multiset β) : f s.prod = (s.map f).prod :=
+ map_multiset_prod f s
+#align ring_hom.map_multiset_prod RingHom.map_multiset_prod
+
+@[deprecated _root_.map_multiset_sum]
+protected lemma RingHom.map_multiset_sum [NonAssocSemiring β] [NonAssocSemiring γ] (f : β →+* γ)
+ (s : Multiset β) : f s.sum = (s.map f).sum :=
+ map_multiset_sum f s
+#align ring_hom.map_multiset_sum RingHom.map_multiset_sum
+
+@[deprecated _root_.map_prod]
+protected lemma RingHom.map_prod [CommSemiring β] [CommSemiring γ] (g : β →+* γ) (f : α → β)
+ (s : Finset α) : g (∏ x in s, f x) = ∏ x in s, g (f x) :=
+ map_prod g f s
+#align ring_hom.map_prod RingHom.map_prod
+
+@[deprecated _root_.map_sum]
+protected lemma RingHom.map_sum [NonAssocSemiring β] [NonAssocSemiring γ] (g : β →+* γ)
+ (f : α → β) (s : Finset α) : g (∑ x in s, f x) = ∑ x in s, g (f x) :=
+ map_sum g f s
+#align ring_hom.map_sum RingHom.map_sum
+
+end Deprecated
+
namespace Finset
-variable {ι α : Type*} {κ : ι → Type*} {s s₁ s₂ : Finset ι} {i : ι} {a : α} {f g : ι → α}
+
+section AddCommMonoidWithOne
+variable [AddCommMonoidWithOne α]
+
+lemma natCast_card_filter (p) [DecidablePred p] (s : Finset ι) :
+ ((filter p s).card : α) = ∑ a in s, if p a then (1 : α) else 0 := by
+ rw [sum_ite, sum_const_zero, add_zero, sum_const, nsmul_one]
+#align finset.nat_cast_card_filter Finset.natCast_card_filter
+
+@[simp] lemma sum_boole (p) [DecidablePred p] (s : Finset ι) :
+ (∑ x in s, if p x then 1 else 0 : α) = (s.filter p).card :=
+ (natCast_card_filter _ _).symm
+#align finset.sum_boole Finset.sum_boole
+
+end AddCommMonoidWithOne
section NonUnitalNonAssocSemiring
variable [NonUnitalNonAssocSemiring α]
@@ -38,6 +109,18 @@ lemma sum_mul_sum {κ : Type*} (s : Finset ι) (t : Finset κ) (f : ι → α) (
simp_rw [sum_mul, ← mul_sum]
#align finset.sum_mul_sum Finset.sum_mul_sum
+lemma _root_.Commute.sum_right [NonUnitalNonAssocSemiring α] (s : Finset ι) (f : ι → α) (b : α)
+ (h : ∀ i ∈ s, Commute b (f i)) : Commute b (∑ i in s, f i) :=
+ (Commute.multiset_sum_right _ _) fun b hb => by
+ obtain ⟨i, hi, rfl⟩ := Multiset.mem_map.mp hb
+ exact h _ hi
+#align commute.sum_right Commute.sum_right
+
+lemma _root_.Commute.sum_left [NonUnitalNonAssocSemiring α] (s : Finset ι) (f : ι → α) (b : α)
+ (h : ∀ i ∈ s, Commute (f i) b) : Commute (∑ i in s, f i) b :=
+ ((Commute.sum_right _ _ _) fun _i hi => (h _ hi).symm).symm
+#align commute.sum_left Commute.sum_left
+
lemma sum_range_succ_mul_sum_range_succ (m n : ℕ) (f g : ℕ → α) :
(∑ i in range (m + 1), f i) * ∑ i in range (n + 1), g i =
(∑ i in range m, f i) * ∑ i in range n, g i +
@@ -72,6 +155,16 @@ end NonAssocSemiring
section CommSemiring
variable [CommSemiring α]
+/-- If `f = g = h` everywhere but at `i`, where `f i = g i + h i`, then the product of `f` over `s`
+ is the sum of the products of `g` and `h`. -/
+theorem prod_add_prod_eq {s : Finset ι} {i : ι} {f g h : ι → α} (hi : i ∈ s)
+ (h1 : g i + h i = f i) (h2 : ∀ j ∈ s, j ≠ i → g j = f j) (h3 : ∀ j ∈ s, j ≠ i → h j = f j) :
+ (∏ i in s, g i) + ∏ i in s, h i = ∏ i in s, f i := by
+ classical
+ simp_rw [prod_eq_mul_prod_diff_singleton hi, ← h1, right_distrib]
+ congr 2 <;> apply prod_congr rfl <;> simpa
+#align finset.prod_add_prod_eq Finset.prod_add_prod_eq
+
section DecidableEq
variable [DecidableEq ι]
@@ -244,3 +337,78 @@ lemma sum_div (s : Finset ι) (f : ι → α) (a : α) :
end DivisionSemiring
end Finset
+
+namespace Nat
+
+@[simp, norm_cast]
+lemma cast_list_sum [AddMonoidWithOne β] (s : List ℕ) : (↑s.sum : β) = (s.map (↑)).sum :=
+ map_list_sum (castAddMonoidHom β) _
+#align nat.cast_list_sum Nat.cast_list_sum
+
+@[simp, norm_cast]
+lemma cast_list_prod [Semiring β] (s : List ℕ) : (↑s.prod : β) = (s.map (↑)).prod :=
+ map_list_prod (castRingHom β) _
+#align nat.cast_list_prod Nat.cast_list_prod
+
+@[simp, norm_cast]
+lemma cast_multiset_sum [AddCommMonoidWithOne β] (s : Multiset ℕ) :
+ (↑s.sum : β) = (s.map (↑)).sum :=
+ map_multiset_sum (castAddMonoidHom β) _
+#align nat.cast_multiset_sum Nat.cast_multiset_sum
+
+@[simp, norm_cast]
+lemma cast_multiset_prod [CommSemiring β] (s : Multiset ℕ) : (↑s.prod : β) = (s.map (↑)).prod :=
+ map_multiset_prod (castRingHom β) _
+#align nat.cast_multiset_prod Nat.cast_multiset_prod
+
+@[simp, norm_cast]
+lemma cast_sum [AddCommMonoidWithOne β] (s : Finset α) (f : α → ℕ) :
+ ↑(∑ x in s, f x : ℕ) = ∑ x in s, (f x : β) :=
+ map_sum (castAddMonoidHom β) _ _
+#align nat.cast_sum Nat.cast_sum
+
+@[simp, norm_cast]
+lemma cast_prod [CommSemiring β] (f : α → ℕ) (s : Finset α) :
+ (↑(∏ i in s, f i) : β) = ∏ i in s, (f i : β) :=
+ map_prod (castRingHom β) _ _
+#align nat.cast_prod Nat.cast_prod
+
+end Nat
+
+namespace Int
+
+@[simp, norm_cast]
+lemma cast_list_sum [AddGroupWithOne β] (s : List ℤ) : (↑s.sum : β) = (s.map (↑)).sum :=
+ map_list_sum (castAddHom β) _
+#align int.cast_list_sum Int.cast_list_sum
+
+@[simp, norm_cast]
+lemma cast_list_prod [Ring β] (s : List ℤ) : (↑s.prod : β) = (s.map (↑)).prod :=
+ map_list_prod (castRingHom β) _
+#align int.cast_list_prod Int.cast_list_prod
+
+@[simp, norm_cast]
+lemma cast_multiset_sum [AddCommGroupWithOne β] (s : Multiset ℤ) :
+ (↑s.sum : β) = (s.map (↑)).sum :=
+ map_multiset_sum (castAddHom β) _
+#align int.cast_multiset_sum Int.cast_multiset_sum
+
+@[simp, norm_cast]
+lemma cast_multiset_prod {R : Type*} [CommRing R] (s : Multiset ℤ) :
+ (↑s.prod : R) = (s.map (↑)).prod :=
+ map_multiset_prod (castRingHom R) _
+#align int.cast_multiset_prod Int.cast_multiset_prod
+
+@[simp, norm_cast]
+lemma cast_sum [AddCommGroupWithOne β] (s : Finset α) (f : α → ℤ) :
+ ↑(∑ x in s, f x : ℤ) = ∑ x in s, (f x : β) :=
+ map_sum (castAddHom β) _ _
+#align int.cast_sum Int.cast_sum
+
+@[simp, norm_cast]
+lemma cast_prod {R : Type*} [CommRing R] (f : α → ℤ) (s : Finset α) :
+ (↑(∏ i in s, f i) : R) = ∏ i in s, (f i : R) :=
+ map_prod (Int.castRingHom R) _ _
+#align int.cast_prod Int.cast_prod
+
+end Int
RingHom.map_*
to _root_.map_*
(#11660)
Cherry-picked from #9607 Co-authored-by: @semorrison
@@ -197,7 +197,7 @@ lemma _root_.Fintype.sum_pow_mul_eq_add_pow (ι : Type*) [Fintype ι] (a b : α)
@[norm_cast]
theorem prod_natCast (s : Finset ι) (f : ι → ℕ) : ↑(∏ i in s, f i : ℕ) = ∏ i in s, (f i : α) :=
- (Nat.castRingHom α).map_prod f s
+ map_prod (Nat.castRingHom α) f s
#align finset.prod_nat_cast Finset.prod_natCast
end CommSemiring
@@ -73,12 +73,13 @@ section CommSemiring
variable [CommSemiring α]
section DecidableEq
-variable [DecidableEq ι] [∀ i, DecidableEq (κ i)]
+variable [DecidableEq ι]
/-- The product over a sum can be written as a sum over the product of sets, `Finset.Pi`.
`Finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
lemma prod_sum (s : Finset ι) (t : ∀ i, Finset (κ i)) (f : ∀ i, κ i → α) :
∏ a in s, ∑ b in t a, f a b = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) := by
+ classical
induction' s using Finset.induction with a s ha ih
· rw [pi_empty, sum_singleton]
rfl
@@ -121,7 +122,7 @@ lemma sum_prod_piFinset {κ : Type*} [Fintype ι] (s : Finset κ) (g : ι → κ
lemma sum_pow' (s : Finset ι) (f : ι → α) (n : ℕ) :
(∑ a in s, f a) ^ n = ∑ p in piFinset fun _i : Fin n ↦ s, ∏ i, f (p i) := by
- classical convert @prod_univ_sum (Fin n) _ _ _ _ _ _ (fun _i ↦ s) fun _i d ↦ f d; simp
+ classical convert @prod_univ_sum (Fin n) _ _ _ _ _ (fun _i ↦ s) fun _i d ↦ f d; simp
/-- The product of `f a + g a` over all of `s` is the sum over the powerset of `s` of the product of
`f` over a subset `t` times the product of `g` over the complement of `t` -/
A bunch of lemmas in Algebra.BigOperators.Ring
were not about rings. This PR moves them along with some lemmas from Data.Fintype.BigOperators
to their correct place.
I create a new file with the content from #6605 to avoid importing Fin
material in finset files as a result.
From LeanAPAP
@@ -5,8 +5,7 @@ Authors: Johannes Hölzl
-/
import Mathlib.Algebra.BigOperators.Basic
import Mathlib.Algebra.Field.Defs
-import Mathlib.Data.Finset.Pi
-import Mathlib.Data.Finset.Powerset
+import Mathlib.Data.Fintype.Powerset
#align_import algebra.big_operators.ring from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
@@ -17,87 +16,69 @@ We prove results about big operators that involve some interaction between
multiplicative and additive structures on the values being combined.
-/
-
-universe u v w
-
-open BigOperators
-
-variable {α : Type u} {β : Type v} {γ : Type w}
+open Fintype
+open scoped BigOperators
namespace Finset
+variable {ι α : Type*} {κ : ι → Type*} {s s₁ s₂ : Finset ι} {i : ι} {a : α} {f g : ι → α}
-variable {s s₁ s₂ : Finset α} {a : α} {b : β} {f g : α → β}
-
-section CommMonoid
-
-variable [CommMonoid β]
-
-open Classical
-
-theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
- ∀ {s : Finset α}, ∏ i in s, x ^ f i = x ^ ∑ x in s, f x := by
- apply Finset.induction
- · simp
- · intro a s has H
- rw [Finset.prod_insert has, Finset.sum_insert has, pow_add, H]
-#align finset.prod_pow_eq_pow_sum Finset.prod_pow_eq_pow_sum
+section NonUnitalNonAssocSemiring
+variable [NonUnitalNonAssocSemiring α]
-end CommMonoid
-
-section Semiring
-
-variable [NonUnitalNonAssocSemiring β]
-
-theorem sum_mul : (∑ x in s, f x) * b = ∑ x in s, f x * b :=
- map_sum (AddMonoidHom.mulRight b) _ s
+lemma sum_mul (s : Finset ι) (f : ι → α) (a : α) :
+ (∑ i in s, f i) * a = ∑ i in s, f i * a := map_sum (AddMonoidHom.mulRight a) _ s
#align finset.sum_mul Finset.sum_mul
-theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
- map_sum (AddMonoidHom.mulLeft b) _ s
+lemma mul_sum (s : Finset ι) (f : ι → α) (a : α) :
+ a * ∑ i in s, f i = ∑ i in s, a * f i := map_sum (AddMonoidHom.mulLeft a) _ s
#align finset.mul_sum Finset.mul_sum
-theorem sum_mul_sum {ι₁ : Type*} {ι₂ : Type*} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
- (f₂ : ι₂ → β) :
- ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 := by
- rw [sum_product, sum_mul, sum_congr rfl]
- intros
- rw [mul_sum]
+lemma sum_mul_sum {κ : Type*} (s : Finset ι) (t : Finset κ) (f : ι → α) (g : κ → α) :
+ (∑ i in s, f i) * ∑ j in t, g j = ∑ i in s, ∑ j in t, f i * g j := by
+ simp_rw [sum_mul, ← mul_sum]
#align finset.sum_mul_sum Finset.sum_mul_sum
-end Semiring
+lemma sum_range_succ_mul_sum_range_succ (m n : ℕ) (f g : ℕ → α) :
+ (∑ i in range (m + 1), f i) * ∑ i in range (n + 1), g i =
+ (∑ i in range m, f i) * ∑ i in range n, g i +
+ f m * ∑ i in range n, g i + (∑ i in range m, f i) * g n + f m * g n := by
+ simp only [add_mul, mul_add, add_assoc, sum_range_succ]
+#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succ
+
+end NonUnitalNonAssocSemiring
-section Semiring
+section NonUnitalSemiring
+variable [NonUnitalSemiring α]
-theorem dvd_sum [NonUnitalSemiring β]
- {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣ f x) : b ∣ ∑ x in s, f x :=
+lemma dvd_sum (h : ∀ i ∈ s, a ∣ f i) : a ∣ ∑ i in s, f i :=
Multiset.dvd_sum fun y hy => by rcases Multiset.mem_map.1 hy with ⟨x, hx, rfl⟩; exact h x hx
#align finset.dvd_sum Finset.dvd_sum
-variable [NonAssocSemiring β]
+end NonUnitalSemiring
+
+section NonAssocSemiring
+variable [NonAssocSemiring α] [DecidableEq ι]
-theorem sum_mul_boole [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
- (∑ x in s, f x * ite (a = x) 1 0) = ite (a ∈ s) (f a) 0 := by simp
+lemma sum_mul_boole (s : Finset ι) (f : ι → α) (i : ι) :
+ ∑ j in s, f j * ite (i = j) 1 0 = ite (i ∈ s) (f i) 0 := by simp
#align finset.sum_mul_boole Finset.sum_mul_boole
-theorem sum_boole_mul [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
- (∑ x in s, ite (a = x) 1 0 * f x) = ite (a ∈ s) (f a) 0 := by simp
+lemma sum_boole_mul (s : Finset ι) (f : ι → α) (i : ι) :
+ ∑ j in s, ite (i = j) 1 0 * f i = ite (i ∈ s) (f i) 0 := by simp
#align finset.sum_boole_mul Finset.sum_boole_mul
-end Semiring
-
-theorem sum_div [DivisionSemiring β] {s : Finset α} {f : α → β} {b : β} :
- (∑ x in s, f x) / b = ∑ x in s, f x / b := by simp only [div_eq_mul_inv, sum_mul]
-#align finset.sum_div Finset.sum_div
+end NonAssocSemiring
section CommSemiring
+variable [CommSemiring α]
-variable [CommSemiring β]
+section DecidableEq
+variable [DecidableEq ι] [∀ i, DecidableEq (κ i)]
/-- The product over a sum can be written as a sum over the product of sets, `Finset.Pi`.
`Finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
-theorem prod_sum {δ : α → Type*} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
- {t : ∀ a, Finset (δ a)} {f : ∀ a, δ a → β} :
- (∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) := by
+lemma prod_sum (s : Finset ι) (t : ∀ i, Finset (κ i)) (f : ∀ i, κ i → α) :
+ ∏ a in s, ∑ b in t a, f a b = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) := by
induction' s using Finset.induction with a s ha ih
· rw [pi_empty, sum_singleton]
rfl
@@ -126,18 +107,32 @@ theorem prod_sum {δ : α → Type*} [DecidableEq α] [∀ a, DecidableEq (δ a)
Subtype.exists, exists_prop, exists_eq_right] using ha
#align finset.prod_sum Finset.prod_sum
-/-- The product of `f a + g a` over all of `s` is the sum
- over the powerset of `s` of the product of `f` over a subset `t` times
- the product of `g` over the complement of `t` -/
-theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
- ∏ a in s, (f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a := by
+/-- The product over `univ` of a sum can be written as a sum over the product of sets,
+`Fintype.piFinset`. `Finset.prod_sum` is an alternative statement when the product is not
+over `univ`. -/
+lemma prod_univ_sum [Fintype ι] (t : ∀ i, Finset (κ i)) (f : ∀ i, κ i → α) :
+ ∏ i, ∑ j in t i, f i j = ∑ x in piFinset t, ∏ i, f i (x i) := by
+ simp only [prod_attach_univ, prod_sum, Finset.sum_univ_pi]
+#align finset.prod_univ_sum Finset.prod_univ_sum
+
+lemma sum_prod_piFinset {κ : Type*} [Fintype ι] (s : Finset κ) (g : ι → κ → α) :
+ ∑ f in piFinset fun _ : ι ↦ s, ∏ i, g i (f i) = ∏ i, ∑ j in s, g i j := by
+ classical rw [← prod_univ_sum]
+
+lemma sum_pow' (s : Finset ι) (f : ι → α) (n : ℕ) :
+ (∑ a in s, f a) ^ n = ∑ p in piFinset fun _i : Fin n ↦ s, ∏ i, f (p i) := by
+ classical convert @prod_univ_sum (Fin n) _ _ _ _ _ _ (fun _i ↦ s) fun _i d ↦ f d; simp
+
+/-- The product of `f a + g a` over all of `s` is the sum over the powerset of `s` of the product of
+`f` over a subset `t` times the product of `g` over the complement of `t` -/
+theorem prod_add (f g : ι → α) (s : Finset ι) :
+ ∏ i in s, (f i + g i) = ∑ t in s.powerset, (∏ i in t, f i) * ∏ i in s \ t, g i := by
classical
calc
- ∏ a in s, (f a + g a) =
- ∏ a in s, ∑ p in ({True, False} : Finset Prop), if p then f a else g a := by simp
+ ∏ i in s, (f i + g i) =
+ ∏ i in s, ∑ p in ({True, False} : Finset Prop), if p then f i else g i := by simp
_ = ∑ p in (s.pi fun _ => {True, False} : Finset (∀ a ∈ s, Prop)),
- ∏ a in s.attach, if p a.1 a.2 then f a.1 else g a.1 :=
- prod_sum
+ ∏ a in s.attach, if p a.1 a.2 then f a.1 else g a.1 := prod_sum _ _ _
_ = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
sum_bij'
(fun f _ ↦ s.filter fun a ↦ ∃ h : a ∈ s, f a h)
@@ -154,9 +149,10 @@ theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
tauto)
#align finset.prod_add Finset.prod_add
+end DecidableEq
+
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
-theorem prod_add_ordered {ι R : Type*} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
- (f g : ι → R) :
+theorem prod_add_ordered [LinearOrder ι] [CommSemiring α] (s : Finset ι) (f g : ι → α) :
∏ i in s, (f i + g i) =
(∏ i in s, f i) +
∑ i in s,
@@ -179,28 +175,9 @@ theorem prod_add_ordered {ι R : Type*} [CommSemiring R] [LinearOrder ι] (s : F
exact mt (fun ha => (mem_filter.1 ha).1) ha'
#align finset.prod_add_ordered Finset.prod_add_ordered
-/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
-theorem prod_sub_ordered {ι R : Type*} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
- ∏ i in s, (f i - g i) =
- (∏ i in s, f i) -
- ∑ i in s,
- g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j := by
- simp only [sub_eq_add_neg]
- convert prod_add_ordered s f fun i => -g i
- simp
-#align finset.prod_sub_ordered Finset.prod_sub_ordered
-
-/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
-a partition of unity from a collection of “bump” functions. -/
-theorem prod_one_sub_ordered {ι R : Type*} [CommRing R] [LinearOrder ι] (s : Finset ι)
- (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) := by
- rw [prod_sub_ordered]
- simp
-#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
-
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `Finset`
gives `(a + b)^s.card`.-/
-theorem sum_pow_mul_eq_add_pow {α R : Type*} [CommSemiring R] (a b : R) (s : Finset α) :
+theorem sum_pow_mul_eq_add_pow (a b : α) (s : Finset ι) :
(∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
classical
rw [← prod_const, prod_add]
@@ -208,19 +185,46 @@ theorem sum_pow_mul_eq_add_pow {α R : Type*} [CommSemiring R] (a b : R) (s : Fi
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
#align finset.sum_pow_mul_eq_add_pow Finset.sum_pow_mul_eq_add_pow
+/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a fintype of cardinality `n`
+gives `(a + b)^n`. The "good" proof involves expanding along all coordinates using the fact that
+`x^n` is multilinear, but multilinear maps are only available now over rings, so we give instead
+a proof reducing to the usual binomial theorem to have a result over semirings. -/
+lemma _root_.Fintype.sum_pow_mul_eq_add_pow (ι : Type*) [Fintype ι] (a b : α) :
+ ∑ s : Finset ι, a ^ s.card * b ^ (Fintype.card ι - s.card) = (a + b) ^ Fintype.card ι :=
+ Finset.sum_pow_mul_eq_add_pow _ _ _
+#align fintype.sum_pow_mul_eq_add_pow Fintype.sum_pow_mul_eq_add_pow
+
@[norm_cast]
-theorem prod_natCast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
- (Nat.castRingHom β).map_prod f s
+theorem prod_natCast (s : Finset ι) (f : ι → ℕ) : ↑(∏ i in s, f i : ℕ) = ∏ i in s, (f i : α) :=
+ (Nat.castRingHom α).map_prod f s
#align finset.prod_nat_cast Finset.prod_natCast
end CommSemiring
section CommRing
+variable [CommRing α]
-variable {R : Type*} [CommRing R]
+/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
+lemma prod_sub_ordered [LinearOrder ι] (s : Finset ι) (f g : ι → α) :
+ ∏ i in s, (f i - g i) =
+ (∏ i in s, f i) -
+ ∑ i in s,
+ g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j := by
+ simp only [sub_eq_add_neg]
+ convert prod_add_ordered s f fun i => -g i
+ simp
+#align finset.prod_sub_ordered Finset.prod_sub_ordered
+
+/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
+a partition of unity from a collection of “bump” functions. -/
+theorem prod_one_sub_ordered [LinearOrder ι] (s : Finset ι) (f : ι → α) :
+ ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) := by
+ rw [prod_sub_ordered]
+ simp
+#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
theorem prod_range_cast_nat_sub (n k : ℕ) :
- ∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) := by
+ ∏ i in range k, (n - i : α) = (∏ i in range k, (n - i) : ℕ) := by
rw [prod_natCast]
rcases le_or_lt k n with hkn | hnk
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
@@ -230,44 +234,12 @@ theorem prod_range_cast_nat_sub (n k : ℕ) :
end CommRing
-/-- A product over all subsets of `s ∪ {x}` is obtained by multiplying the product over all subsets
-of `s`, and over all subsets of `s` to which one adds `x`. -/
-@[to_additive
- "A sum over all subsets of `s ∪ {x}` is obtained by summing the sum over all subsets
- of `s`, and over all subsets of `s` to which one adds `x`."]
-theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x : α} (h : x ∉ s)
- (f : Finset α → β) :
- (∏ a in (insert x s).powerset, f a) =
- (∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) := by
- rw [powerset_insert, Finset.prod_union, Finset.prod_image]
- · intro t₁ h₁ t₂ h₂ heq
- rw [← Finset.erase_insert (not_mem_of_mem_powerset_of_not_mem h₁ h), ←
- Finset.erase_insert (not_mem_of_mem_powerset_of_not_mem h₂ h), heq]
- · rw [Finset.disjoint_iff_ne]
- intro t₁ h₁ t₂ h₂
- rcases Finset.mem_image.1 h₂ with ⟨t₃, _h₃, H₃₂⟩
- rw [← H₃₂]
- exact ne_insert_of_not_mem _ _ (not_mem_of_mem_powerset_of_not_mem h₁ h)
-#align finset.prod_powerset_insert Finset.prod_powerset_insert
-#align finset.sum_powerset_insert Finset.sum_powerset_insert
-
-/-- A product over `powerset s` is equal to the double product over sets of subsets of `s` with
-`card s = k`, for `k = 1, ..., card s`. -/
-@[to_additive
- "A sum over `powerset s` is equal to the double sum over sets of subsets of `s` with
- `card s = k`, for `k = 1, ..., card s`"]
-theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
- ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetCard j s, f t := by
- rw [powerset_card_disjiUnion, prod_disjiUnion]
-#align finset.prod_powerset Finset.prod_powerset
-#align finset.sum_powerset Finset.sum_powerset
-
-theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k : ℕ) (f g : ℕ → β) :
- ((∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i) =
- (((∑ i in range n, f i) * ∑ i in range k, g i) + f n * ∑ i in range k, g i) +
- (∑ i in range n, f i) * g k +
- f n * g k := by
- simp only [add_mul, mul_add, add_assoc, sum_range_succ]
-#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succ
+section DivisionSemiring
+variable [DivisionSemiring α]
+
+lemma sum_div (s : Finset ι) (f : ι → α) (a : α) :
+ (∑ i in s, f i) / a = ∑ i in s, f i / a := by simp only [div_eq_mul_inv, sum_mul]
+#align finset.sum_div Finset.sum_div
+end DivisionSemiring
end Finset
Lemmas around this were a mess, throth in terms of names, statement and location. This PR standardises everything to be in Algebra.BigOperators.Basic
and changes the lemmas to take in InjOn
and SurjOn
assumptions where possible (and where impossible make sure the hypotheses are taken in the correct order) and moves the equality of functions hypothesis last.
Also add a few lemmas that help fix downstream uses by golfing.
From LeanAPAP and LeanCamCombi
@@ -140,23 +140,18 @@ theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
prod_sum
_ = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
sum_bij'
- (fun f _ => s.filter (fun a => ∀ h : a ∈ s, f a h))
- (by simp)
- (fun a _ => by
- rw [prod_ite]
- congr 1
- exact prod_bij'
- (fun a _ => a.1) (by simp) (by simp)
- (fun a ha => ⟨a, (mem_filter.1 ha).1⟩) (fun a ha => by simp at ha; simp; tauto)
- (by simp) (by simp)
- exact prod_bij'
- (fun a _ => a.1) (by simp) (by simp)
- (fun a ha => ⟨a, (mem_sdiff.1 ha).1⟩) (fun a ha => by simp at ha; simp; tauto)
- (by simp) (by simp))
+ (fun f _ ↦ s.filter fun a ↦ ∃ h : a ∈ s, f a h)
(fun t _ a _ => a ∈ t)
+ (by simp)
(by simp [Classical.em])
(by simp_rw [mem_filter, Function.funext_iff, eq_iff_iff, mem_pi, mem_insert]; tauto)
(by simp_rw [ext_iff, @mem_filter _ _ (id _), mem_powerset]; tauto)
+ (fun a _ ↦ by
+ simp only [prod_ite, filter_attach', prod_map, Function.Embedding.coeFn_mk,
+ Subtype.map_coe, id_eq, prod_attach, filter_congr_decidable]
+ congr 2 with x
+ simp only [mem_filter, mem_sdiff, not_and, not_exists, and_congr_right_iff]
+ tauto)
#align finset.prod_add Finset.prod_add
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
cases'
(#9171)
I literally went through and regex'd some uses of cases'
, replacing them with rcases
; this is meant to be a low effort PR as I hope that tools can do this in the future.
rcases
is an easier replacement than cases
, though with better tools we could in future do a second pass converting simple rcases
added here (and existing ones) to cases
.
@@ -227,7 +227,7 @@ variable {R : Type*} [CommRing R]
theorem prod_range_cast_nat_sub (n k : ℕ) :
∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) := by
rw [prod_natCast]
- cases' le_or_lt k n with hkn hnk
+ rcases le_or_lt k n with hkn | hnk
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
· rw [← mem_range] at hnk
rw [prod_eq_zero hnk, prod_eq_zero hnk] <;> simp
@@ -106,8 +106,8 @@ theorem prod_sum {δ : α → Type*} [DecidableEq α] [∀ a, DecidableEq (δ a)
intro x _ y _ h
simp only [disjoint_iff_ne, mem_image]
rintro _ ⟨p₂, _, eq₂⟩ _ ⟨p₃, _, eq₃⟩ eq
- have : Pi.cons s a x p₂ a (mem_insert_self _ _) = Pi.cons s a y p₃ a (mem_insert_self _ _) :=
- by rw [eq₂, eq₃, eq]
+ have : Pi.cons s a x p₂ a (mem_insert_self _ _)
+ = Pi.cons s a y p₃ a (mem_insert_self _ _) := by rw [eq₂, eq₃, eq]
rw [Pi.cons_same, Pi.cons_same] at this
exact h this
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_biUnion h₁]
@@ -134,8 +134,7 @@ theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
classical
calc
∏ a in s, (f a + g a) =
- ∏ a in s, ∑ p in ({True, False} : Finset Prop), if p then f a else g a :=
- by simp
+ ∏ a in s, ∑ p in ({True, False} : Finset Prop), if p then f a else g a := by simp
_ = ∑ p in (s.pi fun _ => {True, False} : Finset (∀ a ∈ s, Prop)),
∏ a in s.attach, if p a.1 a.2 then f a.1 else g a.1 :=
prod_sum
This incorporates changes from
nightly-testing
are unexciting: we need to fully qualify a few names)They can all be closed when this is merged.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -147,7 +147,7 @@ theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
rw [prod_ite]
congr 1
exact prod_bij'
- (fun a _ => a.1) (by simp; tauto) (by simp)
+ (fun a _ => a.1) (by simp) (by simp)
(fun a ha => ⟨a, (mem_filter.1 ha).1⟩) (fun a ha => by simp at ha; simp; tauto)
(by simp) (by simp)
exact prod_bij'
@@ -263,7 +263,7 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
"A sum over `powerset s` is equal to the double sum over sets of subsets of `s` with
`card s = k`, for `k = 1, ..., card s`"]
theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
- ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
+ ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetCard j s, f t := by
rw [powerset_card_disjiUnion, prod_disjiUnion]
#align finset.prod_powerset Finset.prod_powerset
#align finset.sum_powerset Finset.sum_powerset
@@ -68,6 +68,11 @@ end Semiring
section Semiring
+theorem dvd_sum [NonUnitalSemiring β]
+ {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣ f x) : b ∣ ∑ x in s, f x :=
+ Multiset.dvd_sum fun y hy => by rcases Multiset.mem_map.1 hy with ⟨x, hx, rfl⟩; exact h x hx
+#align finset.dvd_sum Finset.dvd_sum
+
variable [NonAssocSemiring β]
theorem sum_mul_boole [DecidableEq α] (s : Finset α) (f : α → β) (a : α) :
@@ -209,10 +214,6 @@ theorem sum_pow_mul_eq_add_pow {α R : Type*} [CommSemiring R] (a b : R) (s : Fi
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
#align finset.sum_pow_mul_eq_add_pow Finset.sum_pow_mul_eq_add_pow
-theorem dvd_sum {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣ f x) : b ∣ ∑ x in s, f x :=
- Multiset.dvd_sum fun y hy => by rcases Multiset.mem_map.1 hy with ⟨x, hx, rfl⟩; exact h x hx
-#align finset.dvd_sum Finset.dvd_sum
-
@[norm_cast]
theorem prod_natCast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
(Nat.castRingHom β).map_prod f s
@@ -151,8 +151,7 @@ theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
(by simp) (by simp))
(fun t _ a _ => a ∈ t)
(by simp [Classical.em])
- (by simp_rw [mem_filter, Function.funext_iff, eq_iff_iff, mem_singleton, mem_pi,
- mem_insert, iff_true, iff_false]; tauto)
+ (by simp_rw [mem_filter, Function.funext_iff, eq_iff_iff, mem_pi, mem_insert]; tauto)
(by simp_rw [ext_iff, @mem_filter _ _ (id _), mem_powerset]; tauto)
#align finset.prod_add Finset.prod_add
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -56,7 +56,7 @@ theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
map_sum (AddMonoidHom.mulLeft b) _ s
#align finset.mul_sum Finset.mul_sum
-theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
+theorem sum_mul_sum {ι₁ : Type*} {ι₂ : Type*} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
(f₂ : ι₂ → β) :
((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 := by
rw [sum_product, sum_mul, sum_congr rfl]
@@ -90,7 +90,7 @@ variable [CommSemiring β]
/-- The product over a sum can be written as a sum over the product of sets, `Finset.Pi`.
`Finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
-theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
+theorem prod_sum {δ : α → Type*} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
{t : ∀ a, Finset (δ a)} {f : ∀ a, δ a → β} :
(∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) := by
induction' s using Finset.induction with a s ha ih
@@ -157,7 +157,7 @@ theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
#align finset.prod_add Finset.prod_add
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
-theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
+theorem prod_add_ordered {ι R : Type*} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
(f g : ι → R) :
∏ i in s, (f i + g i) =
(∏ i in s, f i) +
@@ -182,7 +182,7 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
#align finset.prod_add_ordered Finset.prod_add_ordered
/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
-theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
+theorem prod_sub_ordered {ι R : Type*} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
∏ i in s, (f i - g i) =
(∏ i in s, f i) -
∑ i in s,
@@ -194,7 +194,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
-theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
+theorem prod_one_sub_ordered {ι R : Type*} [CommRing R] [LinearOrder ι] (s : Finset ι)
(f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) := by
rw [prod_sub_ordered]
simp
@@ -202,7 +202,7 @@ theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s :
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `Finset`
gives `(a + b)^s.card`.-/
-theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
+theorem sum_pow_mul_eq_add_pow {α R : Type*} [CommSemiring R] (a b : R) (s : Finset α) :
(∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
classical
rw [← prod_const, prod_add]
@@ -223,7 +223,7 @@ end CommSemiring
section CommRing
-variable {R : Type _} [CommRing R]
+variable {R : Type*} [CommRing R]
theorem prod_range_cast_nat_sub (n k : ℕ) :
∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) := by
DecidableEq
instance for Finset.prod_add
(#5798)
Remove the use of a classical DecidableEq
instance from Finset.prod_add
.
@@ -121,12 +121,12 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
Subtype.exists, exists_prop, exists_eq_right] using ha
#align finset.prod_sum Finset.prod_sum
-open Classical
/-- The product of `f a + g a` over all of `s` is the sum
over the powerset of `s` of the product of `f` over a subset `t` times
the product of `g` over the complement of `t` -/
-theorem prod_add (f g : α → β) (s : Finset α) :
- ∏ a in s, (f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
+theorem prod_add [DecidableEq α] (f g : α → β) (s : Finset α) :
+ ∏ a in s, (f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a := by
+ classical
calc
∏ a in s, (f a + g a) =
∏ a in s, ∑ p in ({True, False} : Finset Prop), if p then f a else g a :=
@@ -151,8 +151,9 @@ theorem prod_add (f g : α → β) (s : Finset α) :
(by simp) (by simp))
(fun t _ a _ => a ∈ t)
(by simp [Classical.em])
- (by simp [Function.funext_iff]; tauto)
- (by simp [Finset.ext_iff, @mem_filter _ _ (id _)]; tauto)
+ (by simp_rw [mem_filter, Function.funext_iff, eq_iff_iff, mem_singleton, mem_pi,
+ mem_insert, iff_true, iff_false]; tauto)
+ (by simp_rw [ext_iff, @mem_filter _ _ (id _), mem_powerset]; tauto)
#align finset.prod_add Finset.prod_add
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
@@ -203,6 +204,7 @@ theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s :
gives `(a + b)^s.card`.-/
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
(∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
+ classical
rw [← prod_const, prod_add]
refine' Finset.sum_congr rfl fun t ht => _
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
@@ -2,17 +2,14 @@
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
-
-! This file was ported from Lean 3 source module algebra.big_operators.ring
-! leanprover-community/mathlib commit b2c89893177f66a48daf993b7ba5ef7cddeff8c9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.BigOperators.Basic
import Mathlib.Algebra.Field.Defs
import Mathlib.Data.Finset.Pi
import Mathlib.Data.Finset.Powerset
+#align_import algebra.big_operators.ring from "leanprover-community/mathlib"@"b2c89893177f66a48daf993b7ba5ef7cddeff8c9"
+
/-!
# Results about big operators with values in a (semi)ring
@@ -152,7 +152,7 @@ theorem prod_add (f g : α → β) (s : Finset α) :
(fun a _ => a.1) (by simp) (by simp)
(fun a ha => ⟨a, (mem_sdiff.1 ha).1⟩) (fun a ha => by simp at ha; simp; tauto)
(by simp) (by simp))
- (fun t _ a _ => a ∈ t)
+ (fun t _ a _ => a ∈ t)
(by simp [Classical.em])
(by simp [Function.funext_iff]; tauto)
(by simp [Finset.ext_iff, @mem_filter _ _ (id _)]; tauto)
∑'
precedence (#5615)
∑
, ∏
and variants).([^a-zA-Zα-ωΑ-Ω'𝓝ℳ₀𝕂ₛ)]) \(([∑∏][^()∑∏]*,[^()∑∏:]*)\) ([⊂⊆=<≤])
replaced by $1 $2 $3
@@ -38,7 +38,7 @@ variable [CommMonoid β]
open Classical
theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
- ∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x := by
+ ∀ {s : Finset α}, ∏ i in s, x ^ f i = x ^ ∑ x in s, f x := by
apply Finset.induction
· simp
· intro a s has H
@@ -264,7 +264,7 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
"A sum over `powerset s` is equal to the double sum over sets of subsets of `s` with
`card s = k`, for `k = 1, ..., card s`"]
theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
- (∏ t in powerset s, f t) = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
+ ∏ t in powerset s, f t = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
rw [powerset_card_disjiUnion, prod_disjiUnion]
#align finset.prod_powerset Finset.prod_powerset
#align finset.sum_powerset Finset.sum_powerset
SProd
to implement overloaded notation · ×ˢ ·
(#4200)
Currently, the following notations are changed from · ×ˢ ·
because Lean 4 can't deal with ambiguous notations.
| Definition | Notation |
| :
Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Chris Hughes <chrishughes24@gmail.com>
@@ -61,7 +61,7 @@ theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
(f₂ : ι₂ → β) :
- ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p.1 * f₂ p.2 := by
+ ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ˢ s₂, f₁ p.1 * f₂ p.2 := by
rw [sum_product, sum_mul, sum_congr rfl]
intros
rw [mul_sum]
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johannes Hölzl
! This file was ported from Lean 3 source module algebra.big_operators.ring
-! leanprover-community/mathlib commit 008205aa645b3f194c1da47025c5f110c8406eab
+! leanprover-community/mathlib commit b2c89893177f66a48daf993b7ba5ef7cddeff8c9
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -111,7 +111,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_biUnion h₁]
refine' sum_congr rfl fun b _ => _
have h₂ : ∀ p₁ ∈ pi s t, ∀ p₂ ∈ pi s t, Pi.cons s a b p₁ = Pi.cons s a b p₂ → p₁ = p₂ :=
- fun p₁ _ p₂ _ eq => pi_cons_injective ha eq
+ fun p₁ _ p₂ _ eq => Pi.cons_injective ha eq
rw [sum_image h₂, mul_sum]
refine' sum_congr rfl fun g _ => _
rw [attach_insert, prod_insert, prod_image]
sSup
/iSup
(#3938)
As discussed on Zulip
supₛ
→ sSup
infₛ
→ sInf
supᵢ
→ iSup
infᵢ
→ iInf
bsupₛ
→ bsSup
binfₛ
→ bsInf
bsupᵢ
→ biSup
binfᵢ
→ biInf
csupₛ
→ csSup
cinfₛ
→ csInf
csupᵢ
→ ciSup
cinfᵢ
→ ciInf
unionₛ
→ sUnion
interₛ
→ sInter
unionᵢ
→ iUnion
interᵢ
→ iInter
bunionₛ
→ bsUnion
binterₛ
→ bsInter
bunionᵢ
→ biUnion
binterᵢ
→ biInter
Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
@@ -108,7 +108,7 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
by rw [eq₂, eq₃, eq]
rw [Pi.cons_same, Pi.cons_same] at this
exact h this
- rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_bunionᵢ h₁]
+ rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_biUnion h₁]
refine' sum_congr rfl fun b _ => _
have h₂ : ∀ p₁ ∈ pi s t, ∀ p₂ ∈ pi s t, Pi.cons s a b p₁ = Pi.cons s a b p₂ → p₁ = p₂ :=
fun p₁ _ p₂ _ eq => pi_cons_injective ha eq
@@ -265,7 +265,7 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
`card s = k`, for `k = 1, ..., card s`"]
theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
(∏ t in powerset s, f t) = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
- rw [powerset_card_disjUnionᵢ, prod_disjUnionᵢ]
+ rw [powerset_card_disjiUnion, prod_disjiUnion]
#align finset.prod_powerset Finset.prod_powerset
#align finset.sum_powerset Finset.sum_powerset
by
s! (#3825)
This PR puts, with one exception, every single remaining by
that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh
. The exception is when the by
begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.
Essentially this is s/\n *by$/ by/g
, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated by
s".
@@ -227,8 +227,7 @@ section CommRing
variable {R : Type _} [CommRing R]
theorem prod_range_cast_nat_sub (n k : ℕ) :
- ∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
- by
+ ∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) := by
rw [prod_natCast]
cases' le_or_lt k n with hkn hnk
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
@@ -100,25 +100,25 @@ theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a
· rw [pi_empty, sum_singleton]
rfl
· have h₁ : ∀ x ∈ t a, ∀ y ∈ t a, x ≠ y →
- Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
+ Disjoint (image (Pi.cons s a x) (pi s t)) (image (Pi.cons s a y) (pi s t)) := by
intro x _ y _ h
simp only [disjoint_iff_ne, mem_image]
rintro _ ⟨p₂, _, eq₂⟩ _ ⟨p₃, _, eq₃⟩ eq
- have : pi.cons s a x p₂ a (mem_insert_self _ _) = pi.cons s a y p₃ a (mem_insert_self _ _) :=
+ have : Pi.cons s a x p₂ a (mem_insert_self _ _) = Pi.cons s a y p₃ a (mem_insert_self _ _) :=
by rw [eq₂, eq₃, eq]
- rw [pi.cons_same, pi.cons_same] at this
+ rw [Pi.cons_same, Pi.cons_same] at this
exact h this
rw [prod_insert ha, pi_insert ha, ih, sum_mul, sum_bunionᵢ h₁]
refine' sum_congr rfl fun b _ => _
- have h₂ : ∀ p₁ ∈ pi s t, ∀ p₂ ∈ pi s t, pi.cons s a b p₁ = pi.cons s a b p₂ → p₁ = p₂ :=
+ have h₂ : ∀ p₁ ∈ pi s t, ∀ p₂ ∈ pi s t, Pi.cons s a b p₁ = Pi.cons s a b p₂ → p₁ = p₂ :=
fun p₁ _ p₂ _ eq => pi_cons_injective ha eq
rw [sum_image h₂, mul_sum]
refine' sum_congr rfl fun g _ => _
rw [attach_insert, prod_insert, prod_image]
- · simp only [pi.cons_same]
+ · simp only [Pi.cons_same]
congr with ⟨v, hv⟩
congr
- exact (pi.cons_ne (by rintro rfl; exact ha hv)).symm
+ exact (Pi.cons_ne (by rintro rfl; exact ha hv)).symm
· exact fun _ _ _ _ => Subtype.eq ∘ Subtype.mk.inj
· simpa only [mem_image, mem_attach, Subtype.mk.injEq, true_and,
Subtype.exists, exists_prop, exists_eq_right] using ha
@@ -23,7 +23,7 @@ multiplicative and additive structures on the values being combined.
universe u v w
--- open BigOperators -- Porting note: commented out locale
+open BigOperators
variable {α : Type u} {β : Type v} {γ : Type w}
This PR is the result of a slight variant on the following "algorithm"
_
and make all uppercase letters into lowercase_
and make all uppercase letters into lowercase(original_lean3_name, OriginalLean4Name)
#align
statement just before the next empty line#align
statement to have been inserted too early)@@ -257,6 +257,7 @@ theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x
rw [← H₃₂]
exact ne_insert_of_not_mem _ _ (not_mem_of_mem_powerset_of_not_mem h₁ h)
#align finset.prod_powerset_insert Finset.prod_powerset_insert
+#align finset.sum_powerset_insert Finset.sum_powerset_insert
/-- A product over `powerset s` is equal to the double product over sets of subsets of `s` with
`card s = k`, for `k = 1, ..., card s`. -/
@@ -267,6 +268,7 @@ theorem prod_powerset [CommMonoid β] (s : Finset α) (f : Finset α → β) :
(∏ t in powerset s, f t) = ∏ j in range (card s + 1), ∏ t in powersetLen j s, f t := by
rw [powerset_card_disjUnionᵢ, prod_disjUnionᵢ]
#align finset.prod_powerset Finset.prod_powerset
+#align finset.sum_powerset Finset.sum_powerset
theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k : ℕ) (f g : ℕ → β) :
((∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i) =
@@ -38,8 +38,7 @@ variable [CommMonoid β]
open Classical
theorem prod_pow_eq_pow_sum {x : β} {f : α → ℕ} :
- ∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x :=
- by
+ ∀ {s : Finset α}, (∏ i in s, x ^ f i) = x ^ ∑ x in s, f x := by
apply Finset.induction
· simp
· intro a s has H
@@ -61,8 +60,8 @@ theorem mul_sum : (b * ∑ x in s, f x) = ∑ x in s, b * f x :=
#align finset.mul_sum Finset.mul_sum
theorem sum_mul_sum {ι₁ : Type _} {ι₂ : Type _} (s₁ : Finset ι₁) (s₂ : Finset ι₂) (f₁ : ι₁ → β)
- (f₂ : ι₂ → β) : ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p.1 * f₂ p.2 :=
- by
+ (f₂ : ι₂ → β) :
+ ((∑ x₁ in s₁, f₁ x₁) * ∑ x₂ in s₂, f₂ x₂) = ∑ p in s₁ ×ᶠ s₂, f₁ p.1 * f₂ p.2 := by
rw [sum_product, sum_mul, sum_congr rfl]
intros
rw [mul_sum]
@@ -96,13 +95,12 @@ variable [CommSemiring β]
`Finset.prod_univ_sum` is an alternative statement when the product is over `univ`. -/
theorem prod_sum {δ : α → Type _} [DecidableEq α] [∀ a, DecidableEq (δ a)] {s : Finset α}
{t : ∀ a, Finset (δ a)} {f : ∀ a, δ a → β} :
- (∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) :=
- by
+ (∏ a in s, ∑ b in t a, f a b) = ∑ p in s.pi t, ∏ x in s.attach, f x.1 (p x.1 x.2) := by
induction' s using Finset.induction with a s ha ih
· rw [pi_empty, sum_singleton]
rfl
- · have h₁ : ∀ x ∈ t a,∀ y ∈ t a,
- x ≠ y → Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
+ · have h₁ : ∀ x ∈ t a, ∀ y ∈ t a, x ≠ y →
+ Disjoint (image (pi.cons s a x) (pi s t)) (image (pi.cons s a y) (pi s t)) := by
intro x _ y _ h
simp only [disjoint_iff_ne, mem_image]
rintro _ ⟨p₂, _, eq₂⟩ _ ⟨p₃, _, eq₃⟩ eq
@@ -166,8 +164,7 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
∏ i in s, (f i + g i) =
(∏ i in s, f i) +
∑ i in s,
- g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j :=
- by
+ g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j := by
refine' Finset.induction_on_max s (by simp) _
clear s
intro a s ha ihs
@@ -191,8 +188,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
∏ i in s, (f i - g i) =
(∏ i in s, f i) -
∑ i in s,
- g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j :=
- by
+ g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j := by
simp only [sub_eq_add_neg]
convert prod_add_ordered s f fun i => -g i
simp
@@ -201,8 +197,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
- (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) :=
- by
+ (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) := by
rw [prod_sub_ordered]
simp
#align finset.prod_one_sub_ordered Finset.prod_one_sub_ordered
@@ -210,8 +205,7 @@ theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s :
/-- Summing `a^s.card * b^(n-s.card)` over all finite subsets `s` of a `Finset`
gives `(a + b)^s.card`.-/
theorem sum_pow_mul_eq_add_pow {α R : Type _} [CommSemiring R] (a b : R) (s : Finset α) :
- (∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card :=
- by
+ (∑ t in s.powerset, a ^ t.card * b ^ (s.card - t.card)) = (a + b) ^ s.card := by
rw [← prod_const, prod_add]
refine' Finset.sum_congr rfl fun t ht => _
rw [prod_const, prod_const, ← card_sdiff (mem_powerset.1 ht)]
@@ -222,9 +216,9 @@ theorem dvd_sum {b : β} {s : Finset α} {f : α → β} (h : ∀ x ∈ s, b ∣
#align finset.dvd_sum Finset.dvd_sum
@[norm_cast]
-theorem prod_nat_cast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
+theorem prod_natCast (s : Finset α) (f : α → ℕ) : ↑(∏ x in s, f x : ℕ) = ∏ x in s, (f x : β) :=
(Nat.castRingHom β).map_prod f s
-#align finset.prod_nat_cast Finset.prod_nat_cast
+#align finset.prod_nat_cast Finset.prod_natCast
end CommSemiring
@@ -235,7 +229,7 @@ variable {R : Type _} [CommRing R]
theorem prod_range_cast_nat_sub (n k : ℕ) :
∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
by
- rw [prod_nat_cast]
+ rw [prod_natCast]
cases' le_or_lt k n with hkn hnk
· exact prod_congr rfl fun i hi => (Nat.cast_sub <| (mem_range.1 hi).le.trans hkn).symm
· rw [← mem_range] at hnk
@@ -252,8 +246,7 @@ of `s`, and over all subsets of `s` to which one adds `x`. -/
theorem prod_powerset_insert [DecidableEq α] [CommMonoid β] {s : Finset α} {x : α} (h : x ∉ s)
(f : Finset α → β) :
(∏ a in (insert x s).powerset, f a) =
- (∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) :=
- by
+ (∏ a in s.powerset, f a) * ∏ t in s.powerset, f (insert x t) := by
rw [powerset_insert, Finset.prod_union, Finset.prod_image]
· intro t₁ h₁ t₂ h₂ heq
rw [← Finset.erase_insert (not_mem_of_mem_powerset_of_not_mem h₁ h), ←
@@ -279,8 +272,8 @@ theorem sum_range_succ_mul_sum_range_succ [NonUnitalNonAssocSemiring β] (n k :
((∑ i in range (n + 1), f i) * ∑ i in range (k + 1), g i) =
(((∑ i in range n, f i) * ∑ i in range k, g i) + f n * ∑ i in range k, g i) +
(∑ i in range n, f i) * g k +
- f n * g k :=
- by simp only [add_mul, mul_add, add_assoc, sum_range_succ]
+ f n * g k := by
+ simp only [add_mul, mul_add, add_assoc, sum_range_succ]
#align finset.sum_range_succ_mul_sum_range_succ Finset.sum_range_succ_mul_sum_range_succ
end Finset
Sets all big-operator precedences to 67, in keeping with the existing library note and with lean 3. https://github.com/leanprover-community/mathlib4/blob/82cf1905168dc57e7d95ce5576b7991b31e4f6ea/Mathlib/Algebra/BigOperators/Basic.lean#L89-L93
Fixes downstream code that relied on the wrong precedences. In all cases, the change in this PR makes the code match the parenthesization of the mathlib3 version.
I came across this problem when I tried to write
lemma sum_range_square (n : ℕ) :
∑i in Finset.range n, (i+1)^2 = n * (n + 1) * (2*n + 1)/6 := sorry
and I got the error
failed to synthesize instance
AddCommMonoid Prop
This PR fixes that error, so that my example successfully parses as expected.
@@ -131,9 +131,9 @@ open Classical
over the powerset of `s` of the product of `f` over a subset `t` times
the product of `g` over the complement of `t` -/
theorem prod_add (f g : α → β) (s : Finset α) :
- (∏ a in s, f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
+ ∏ a in s, (f a + g a) = ∑ t in s.powerset, (∏ a in t, f a) * ∏ a in s \ t, g a :=
calc
- (∏ a in s, f a + g a) =
+ ∏ a in s, (f a + g a) =
∏ a in s, ∑ p in ({True, False} : Finset Prop), if p then f a else g a :=
by simp
_ = ∑ p in (s.pi fun _ => {True, False} : Finset (∀ a ∈ s, Prop)),
@@ -163,10 +163,10 @@ theorem prod_add (f g : α → β) (s : Finset α) :
/-- `∏ i, (f i + g i) = (∏ i, f i) + ∑ i, g i * (∏ j < i, f j + g j) * (∏ j > i, f j)`. -/
theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s : Finset ι)
(f g : ι → R) :
- (∏ i in s, f i + g i) =
+ ∏ i in s, (f i + g i) =
(∏ i in s, f i) +
∑ i in s,
- (g i * ∏ j in s.filter (· < i), f j + g j) * ∏ j in s.filter fun j => i < j, f j :=
+ g i * (∏ j in s.filter (· < i), (f j + g j)) * ∏ j in s.filter fun j => i < j, f j :=
by
refine' Finset.induction_on_max s (by simp) _
clear s
@@ -188,10 +188,10 @@ theorem prod_add_ordered {ι R : Type _} [CommSemiring R] [LinearOrder ι] (s :
/-- `∏ i, (f i - g i) = (∏ i, f i) - ∑ i, g i * (∏ j < i, f j - g j) * (∏ j > i, f j)`. -/
theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι) (f g : ι → R) :
- (∏ i in s, f i - g i) =
+ ∏ i in s, (f i - g i) =
(∏ i in s, f i) -
∑ i in s,
- (g i * ∏ j in s.filter (· < i), f j - g j) * ∏ j in s.filter fun j => i < j, f j :=
+ g i * (∏ j in s.filter (· < i), (f j - g j)) * ∏ j in s.filter fun j => i < j, f j :=
by
simp only [sub_eq_add_neg]
convert prod_add_ordered s f fun i => -g i
@@ -201,7 +201,7 @@ theorem prod_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Fins
/-- `∏ i, (1 - f i) = 1 - ∑ i, f i * (∏ j < i, 1 - f j)`. This formula is useful in construction of
a partition of unity from a collection of “bump” functions. -/
theorem prod_one_sub_ordered {ι R : Type _} [CommRing R] [LinearOrder ι] (s : Finset ι)
- (f : ι → R) : (∏ i in s, 1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), 1 - f j :=
+ (f : ι → R) : ∏ i in s, (1 - f i) = 1 - ∑ i in s, f i * ∏ j in s.filter (· < i), (1 - f j) :=
by
rw [prod_sub_ordered]
simp
@@ -233,7 +233,7 @@ section CommRing
variable {R : Type _} [CommRing R]
theorem prod_range_cast_nat_sub (n k : ℕ) :
- (∏ i in range k, (n - i : R)) = (∏ i in range k, n - i : ℕ) :=
+ ∏ i in range k, (n - i : R) = (∏ i in range k, (n - i) : ℕ) :=
by
rw [prod_nat_cast]
cases' le_or_lt k n with hkn hnk
The unported dependencies are