electrical_flow_energy_expansion
For any flows F, G : Fin k → Fin k → ℝ and resistance matrix d, the electrical energy of F + G equals the energy of F plus 2 * (∑ i, ∑ j with i < j, d i j * F i j * G i j) plus the energy of G.
Statement
theorem electrical_flow_energy_expansion {k : ℕ} (d : Fin k → Fin k → ℝ) (F G : Fin k → Fin k → ℝ) : electrical_flow_energy d (fun i j => F i j + G i j) = electrical_flow_energy d F + 2 * (∑ i : Fin k, ∑ j with i < j, d i j * F i j * G i j) + electrical_flow_energy d G
- Source
- arXiv:2611.05669, Appendix A
- Verified
- 06 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- electrical_flow_energyGiven resistance values d on pairs in Fin k and a flow F : Fin k → Fin k → ℝ, the electrical energy of F is the sum ∑ i, ∑ j with i < j, d…
Read back from the Lean
For every natural number $k$, and for all functions $d, F, G : \mathrm{Fin}(k) \to \mathrm{Fin}(k) \to \mathbb{R}$, the electrical flow energy of the pointwise sum $(i, j) \mapsto F(i, j) + G(i, j)$ with respect to $d$ equals the electrical flow energy of $F$ with respect to $d$, plus $2 \sum_{i : \mathrm{Fin}(k)} \sum_{j : \mathrm{Fin}(k), i < j} d(i, j) F(i, j) G(i, j)$, plus the electrical flow energy of $G$ with respect to $d$.
Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.
The proof, explained
The theorem states that the electrical flow energy of the sum of two flows F + G expands as the energy of F, plus twice the mutual cross-energy, plus the energy of G. The proof unfolds the definition of electrical flow energy as a double sum over pairs i < j and combines all three terms on the right-hand side into a single summation. Peeling off the sums by congruence and extensionality reduces the claim to the scalar identity d(F + G)² = d F² + 2 d F G + d G², which is closed by ring arithmetic.
Unfolding the definition of electrical flow energy and gathering the right-hand terms converts the equality into an identity between two double sums over pairs i < j.
We unfold the definition of electrical_flow_energy into double summations over pairs i < j with weights d i j. On the right-hand side, we push the scalar factor 2 inside the summation using Finset.mul_sum, and then combine the three sums into a single double sum using Finset.sum_add_distrib in reverse.
uses
Finset.mul_sum,Finset.sum_add_distribunfold electrical_flow_energy simp_rw [Finset.mul_sum, ← Finset.sum_add_distrib]It suffices to show that the summands are equal for any pair of indices i and j: d i j * (F i j + G i j)^2 = d i j * F i j^2 + 2 * (d i j * F i j * G i j) + d i j * G i j^2.
Both sides are double summations over the same index sets (first over all i : Fin k, then over j with i < j). Using congruence (congr 1) and functional extensionality (ext) on the outer sum over i and the inner sum over j, we strip away both summations to reduce to pointwise equality of the summands.
congr 1 ext i congr 1 ext j
The summands are equal.
The equation d i j * (F i j + G i j)^2 = d i j * F i j^2 + 2 * (d i j * F i j * G i j) + d i j * G i j^2 is an algebraic identity in the ring of real numbers, which follows by expanding (F i j + G i j)^2 = F i j^2 + 2 * F i j * G i j + G i j^2 and distributing multiplication by d i j.
ring
Finset.mul_sum- Multiplication distributes over a finite sum: a * ∑ i ∈ s, f i = ∑ i ∈ s, a * f i.
Finset.sum_add_distrib- The sum of two functions over a finite set equals the sum of their individual sums: ∑ x ∈ s, (f x + g x) = (∑ x ∈ s, f x) + (∑ x ∈ s, g x). Applied in reverse, it combines separate sums over the same set into one.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
/-- Quadratic expansion of electrical flow energy for the sum of two flows. -/theorem electrical_flow_energy_expansion {k : ℕ} (d : Fin k → Fin k → ℝ) (F G : Fin k → Fin k → ℝ) : electrical_flow_energy d (fun i j => F i j + G i j) = electrical_flow_energy d F + 2 * (∑ i : Fin k, ∑ j with i < j, d i j * F i j * G i j) + electrical_flow_energy d G := by unfold electrical_flow_energy simp_rw [Finset.mul_sum, ← Finset.sum_add_distrib] congr 1 ext i congr 1 ext j ring