Documentation

CslibFrontier.Foundations.Data.Finset.ApplyUpdate

Products and sums over an updated function #

Changing one argument of a function changes only the matching factor of a product (or summand of a sum) whose factors depend on the arguments one at a time (Finset.prod_apply_update_of_mem). Unlike Mathlib's Finset.prod_update_of_mem, the factors may apply a different map g j to each argument and the arguments may have dependent types, and the untouched factors are collected over s.erase i, the form produced by Finset.mul_prod_erase.

Main results #

theorem Finset.prod_apply_update_of_mem {ι : Type u_1} {M : Type u_2} {α : ι → Type u_3} [CommMonoid M] [DecidableEq ι] {s : Finset ι} {i : ι} (hi : i ∈ s) (g : (j : ι) → α j → M) (f : (j : ι) → α j) (b : α i) :
∏ j ∈ s, g j (Function.update f i b j) = g i b * ∏ j ∈ s.erase i, g j (f j)

Changing the argument at i ∈ s changes only the i-th factor of a product whose j-th factor depends only on the j-th argument.

theorem Finset.sum_apply_update_of_mem {ι : Type u_1} {M : Type u_2} {α : ι → Type u_3} [AddCommMonoid M] [DecidableEq ι] {s : Finset ι} {i : ι} (hi : i ∈ s) (g : (j : ι) → α j → M) (f : (j : ι) → α j) (b : α i) :
∑ j ∈ s, g j (Function.update f i b j) = g i b + ∑ j ∈ s.erase i, g j (f j)

Changing the argument at i ∈ s changes only the i-th summand of a sum whose j-th summand depends only on the j-th argument.

theorem Finset.prod_apply_update_of_notMem {ι : Type u_1} {M : Type u_2} {α : ι → Type u_3} [CommMonoid M] [DecidableEq ι] {s : Finset ι} {i : ι} (hi : i ∉ s) (g : (j : ι) → α j → M) (f : (j : ι) → α j) (b : α i) :
∏ j ∈ s, g j (Function.update f i b j) = ∏ j ∈ s, g j (f j)

Updating a coordinate outside the index set leaves the product of coordinate maps unchanged.

theorem Finset.sum_apply_update_of_notMem {ι : Type u_1} {M : Type u_2} {α : ι → Type u_3} [AddCommMonoid M] [DecidableEq ι] {s : Finset ι} {i : ι} (hi : i ∉ s) (g : (j : ι) → α j → M) (f : (j : ι) → α j) (b : α i) :
∑ j ∈ s, g j (Function.update f i b j) = ∑ j ∈ s, g j (f j)

Updating a coordinate outside the index set leaves the sum of coordinate maps unchanged.

theorem Fintype.sum_update_sub_add_eq {ι : Type u_1} {M : Type u_2} [Fintype ι] [DecidableEq ι] [AddCommGroup M] (f : ι → M) {i j : ι} (hij : i ≠ j) (a : M) :
∑ k : ι, Function.update (Function.update f i (f i - a)) j (f j + a) k = ∑ k : ι, f k

Transferring a from coordinate i to a distinct coordinate j preserves the total sum.