AFTD Auto-Formalizing Theoretical Domains

matrix_order_four_centered_shift_row_sum

theoremverified

A centered scalar shift preserves zero row sums.

Statement

theorem matrix_order_four_centered_shift_row_sum (L : Matrix (Fin 4) (Fin 4) ℝ)
    (hr : ∀ i, ∑ j, L i j = 0) (b : ℝ) :
    ∀ i, ∑ j, matrix_order_four_centered_shift L b i j = 0
Source
Sector-bound formalization for IN-166; arXiv:math/0508176, Theorem 5.
Verified
27 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
Used by 2

The proof, explained

A centered scalar shift of a $4 \times 4$ real matrix with zero row sums adds $b$ along the diagonal and subtracts $b/4$ from every entry. For any row, the sum of the original matrix entries vanishes by assumption, the diagonal indicator sums to $b$, and subtracting $b/4$ across the four columns subtracts $4(b/4) = b$. These contributions cancel out, leaving a row sum of zero.

  1. It suffices to show that the row sum is zero for an arbitrary row index $i$.

    We fix an arbitrary row index $i \in \text{Fin } 4$.

    line 4

      intro i
  2. The sum of the entries in row $i$ of the shifted matrix equals $0$. automation

    By definition of `matrix_order_four_centered_shift`, the $(i, j)$ entry of the shifted matrix is $L_{i,j} + (\text{if } i = j \text{ then } b \text{ else } 0) - b / 4$. Distributing the summation over addition and subtraction via `Finset.sum_add_distrib` and `Finset.sum_sub_distrib`, the original row sum $\sum_j L_{i,j}$ vanishes by the hypothesis `hr`. The diagonal terms sum to $b$ because $j = i$ exactly once among the four columns of $\text{Fin } 4$, and the constant term $b/4$ summed across the four columns yields $4 \cdot (b / 4)$. The remaining expression $b - 4 \cdot (b / 4) = 0$ is cleared by ring arithmetic.

    lines 5–6

    uses Finset.sum_add_distrib, Finset.sum_sub_distrib

      simp [matrix_order_four_centered_shift, Finset.sum_add_distrib, Finset.sum_sub_distrib, hr]
      <;> ring
Finset.sum_add_distrib
The sum of a sum of two functions over a finite set equals the sum of their individual sums: $\sum_{x \in s} (f(x) + g(x)) = \sum_{x \in s} f(x) + \sum_{x \in s} g(x)$.
Finset.sum_sub_distrib
The sum of a difference of two functions over a finite set equals the difference of their sums: $\sum_{x \in s} (f(x) - g(x)) = \sum_{x \in s} f(x) - \sum_{x \in s} g(x)$.

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

theorem matrix_order_four_centered_shift_row_sum (L : Matrix (Fin 4) (Fin 4) ℝ)    (hr : ∀ i, ∑ j, L i j = 0) (b : ℝ) :    ∀ i, ∑ j, matrix_order_four_centered_shift L b i j = 0 := by  intro i  simp [matrix_order_four_centered_shift, Finset.sum_add_distrib, Finset.sum_sub_distrib, hr]  <;> ring
See it in the graphDiscuss this resultChallenge it