Documentation

CslibFrontier.Foundations.Algebra.BigOperators.Fin

Truncation, telescoping and summation by parts for finite sums #

A finite-vector sum agrees with a shorter range sum when all omitted summands vanish. Finset.sum_range_mul_blocks splits a range into consecutive blocks, and Finset.sum_range_mul_div sums a function that is constant on each block. Finset.two_mul_sum_range_natCast_succ computes the sum of the first positive integers without division. sum_univ_adjacent_differences telescopes differences along a sequence of indexed pairs. sum_univ_smul_by_parts_prefix and sum_univ_smul_by_parts_tail express summation by parts using cumulative sums from the left or from the right.

theorem Finset.sum_range_mul_blocks {M : Type u_1} [AddCommMonoid M] (f : ℕ → M) (m n : ℕ) :
∑ k ∈ range (m * n), f k = ∑ j ∈ range m, ∑ r : Fin n, f (j * n + ↑r)

Split a range of length m * n into m consecutive blocks of length n.

theorem Finset.sum_range_mul_div {M : Type u_1} [AddCommMonoid M] (f : ℕ → M) (m n : ℕ) :
∑ k ∈ range (n * m), f (k / n) = n • ∑ j ∈ range m, f j

Summing a function of the quotient by n over m blocks counts each value n times.

theorem Finset.two_mul_sum_range_natCast_succ {R : Type u_1} [Semiring R] (n : ℕ) :
2 * ∑ i ∈ range n, (↑i + 1) = ↑n * (↑n + 1)

Twice the sum of the positive integers from 1 through n, cast into a semiring.

theorem Fin.sum_eq_sum_range_of_eq_zero {M : Type u_1} [AddCommMonoid M] {n k : ℕ} (hk : k ≤ n) (f : ℕ → M) (hf : ∀ (j : ℕ), k ≤ j → f j = 0) :
∑ j : Fin n, f ↑j = ∑ j ∈ Finset.range k, f j

A sum over Fin n of a function vanishing from k on is a sum over range k.

theorem Fin.sum_univ_adjacent_differences {M : Type u_1} [AddCommGroup M] {n : ℕ} (entry exit : Fin (n + 1) → M) :
∑ i : Fin (n + 1), (exit i - entry i) + ∑ i : Fin n, (entry i.succ - exit i.castSucc) = exit (last n) - entry 0

The differences within indexed pairs and across consecutive pairs telescope to the difference from the first entry to the last exit.

theorem Fin.sum_range_mul_sub_le_of_adjacent {R : Type u_1} [Ring R] [LinearOrder R] [IsOrderedAddMonoid R] (w a b drift : ℕ → R) (D : R) (T : ℕ) (hslack : ∀ t < T, w t * (D - a (t + 1)) ≤ w (t + 1) * (D - a (t + 1))) (hdrift : ∀ t < T, w t * (a (t + 1) - b t) ≤ drift t) :
∑ t ∈ Finset.range (T + 1), w t * (a t - b t) ≤ w T * (D - b T) - w 0 * (D - a 0) + ∑ t ∈ Finset.range T, drift t

A weighted sum of within-round potential drops from a to b is bounded by the endpoint difference in weighted slack plus the inter-round drift. The hslack condition compares weights at the same potential and holds automatically for constant weights.

theorem Fin.sum_univ_smul_by_parts_prefix {R : Type u_1} {M : Type u_2} [Ring R] [AddCommGroup M] [Module R M] {n : ℕ} (a : Fin (n + 1) → R) (b : Fin (n + 1) → M) :
∑ i : Fin (n + 1), a i • b i = (∑ i : Fin (n + 1), a i) • b (last n) + ∑ i : Fin n, (∑ j ≤ i.castSucc, a j) • (b i.castSucc - b i.succ)

Summation by parts on a finite vector using prefix sums and successive differences.

theorem Fin.sum_univ_smul_by_parts_tail {R : Type u_1} {M : Type u_2} [Ring R] [AddCommGroup M] [Module R M] {n : ℕ} (a : Fin (n + 1) → R) (b : Fin (n + 1) → M) :
∑ i : Fin (n + 1), a i • b i = (∑ i : Fin (n + 1), a i) • b 0 + ∑ i : Fin n, (∑ j ≥ i.succ, a j) • (b i.succ - b i.castSucc)

Summation by parts on a finite vector using tail sums and successive differences.