op1957_four_shore_other_counts_sum_identity
Four shore other counts sum identity.
Statement
theorem op1957_four_shore_other_counts_sum_identity (g : Fin 4 → Fin 4 → ℕ) (eb : ℕ) (j forbidden : Fin 4) : (∑ t ∈ (Finset.univ : Finset (Fin 4)).erase forbidden, ((∑ i : Fin 4, g i t) + (if t=1 then eb else 0) - g j t)) = (∑ i ∈ (Finset.univ : Finset (Fin 4)).erase j, ∑ t ∈ (Finset.univ : Finset (Fin 4)).erase forbidden, g i t) + (if forbidden=1 then 0 else eb)
- Source
- OP-1957; positive-separator graph-to-count transfer.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- op1957_four_shore_aggregate_representative_boundsFour shore aggregate representative bounds.
The proof, explained
The theorem states that summing the column sums of a 4 × 4 matrix minus row j (with an extra bonus eb at column 1) over all columns except a forbidden column equals the sum of all matrix entries outside row j and column forbidden, plus eb provided column 1 is not forbidden. Because the index sets are finite with only four elements, the proof proceeds by exhaustive case analysis over all 16 possible pairs of (j, forbidden). In each case, the sums over the punctured domains are expanded into explicit additions of terms, and the resulting linear arithmetic identity in ℕ is verified automatically by omega.
For each k ∈ {0, 1, 2, 3}, the punctured index set Finset.univ.erase k is explicitly {0, 1, 2, 3} \ {k}.
Using classical decidability, direct computation (`decide`) tabulates the complement of each element of Fin 4: removing 0 yields {1, 2, 3}, removing 1 yields {0, 2, 3}, removing 2 yields {0, 1, 3}, and removing 3 yields {0, 1, 2}.
classical have e0 : (Finset.univ : Finset (Fin 4)).erase 0 = {1,2,3} := by decide have e1 : (Finset.univ : Finset (Fin 4)).erase 1 = {0,2,3} := by decide have e2 : (Finset.univ : Finset (Fin 4)).erase 2 = {0,1,3} := by decide have e3 : (Finset.univ : Finset (Fin 4)).erase 3 = {0,1,2} := by decide
The identity holds for all choices of j and forbidden in Fin 4. automation
We perform an exhaustive case split on j and forbidden, yielding 4 × 4 = 16 subgoals. In each case, `simp` rewrites the universal sums using `Fin.sum_univ_four`, replaces the punctured sets with their explicit 3-element listings from `e0`–`e3`, and resolves the `if-then-else` conditions. Each resulting equality in ℕ equates two identical sums of matrix entries of g and copies of eb, which the `omega` decision procedure closes by linear arithmetic.
uses
Fin.sum_univ_fourfin_cases j <;> fin_cases forbidden <;> simp [Fin.sum_univ_four,e0,e1,e2,e3] <;> omega
Fin.sum_univ_four- The sum of any function over Fin 4 in an additive commutative monoid equals the sum of its values at 0, 1, 2, and 3: ∑ i, f i = f 0 + f 1 + f 2 + f 3.
- Line 10 enables classical logic, which provides decidable equality instances for finset operations such as `Finset.erase`; this is a formal requirement in Lean with no counterpart in paper mathematics.
- Line 15 discharges all 16 cases by automated simplification and the `omega` decision procedure for Presburger arithmetic on ℕ.
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.
set_option maxHeartbeats 2000000theorem op1957_four_shore_other_counts_sum_identity (g : Fin 4 → Fin 4 → ℕ) (eb : ℕ) (j forbidden : Fin 4) : (∑ t ∈ (Finset.univ : Finset (Fin 4)).erase forbidden, ((∑ i : Fin 4, g i t) + (if t=1 then eb else 0) - g j t)) = (∑ i ∈ (Finset.univ : Finset (Fin 4)).erase j, ∑ t ∈ (Finset.univ : Finset (Fin 4)).erase forbidden, g i t) + (if forbidden=1 then 0 else eb) := by classical have e0 : (Finset.univ : Finset (Fin 4)).erase 0 = {1,2,3} := by decide have e1 : (Finset.univ : Finset (Fin 4)).erase 1 = {0,2,3} := by decide have e2 : (Finset.univ : Finset (Fin 4)).erase 2 = {0,1,3} := by decide have e3 : (Finset.univ : Finset (Fin 4)).erase 3 = {0,1,2} := by decide fin_cases j <;> fin_cases forbidden <;> simp [Fin.sum_univ_four,e0,e1,e2,e3] <;> omega