op_2130_even_zero_sum_two_defects
A finite integer vector with even coordinates, zero sum, and squared norm at most eight is zero or has exactly one coordinate equal to two and exactly one equal to minus two.
Statement
theorem op_2130_even_zero_sum_two_defects (n : ℕ) (f : Fin n → ℤ) (heven : ∀ i, Even (f i)) (hsum : (∑ i, f i) = 0) (hnorm : (∑ i, (f i)^2) ≤ 8) : (∀ i, f i = 0) ∨ ∃ a b : Fin n, a ≠ b ∧ f a = 2 ∧ f b = -2 ∧ ∀ i, i ≠ a → i ≠ b → f i = 0- Source
- OP-2130: synchronized greedy coupling cannot branch a single coin perturbation
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- TotalPreorderA total preorder: a preorder where
≤is total (complete). This is weaker thanLinearOrder— it does NOT require antisymmetry or… - LinearOrder.toTotalPreorderEvery
LinearOrderis aTotalPreorder.
- TotalPreorderA total preorder: a preorder where
The proof, explained
Writing each even coordinate as f i = 2k, the bound on the sum of squares implies 4k² ≤ 8, restricting each coordinate to {-2, 0, 2} and making every non-zero coordinate square to 4. Consequently, the sum of squares is 4 times the number of non-zero coordinates, which forces there to be at most two non-zero coordinates. A cardinality of zero gives the all-zero vector, a single non-zero coordinate violates the zero-sum condition, and two non-zero coordinates must sum to zero, leaving one equal to 2 and the other to -2.
For every coordinate i, (f i)² ≤ 8.
Because every term in the sum of squares is non-negative, each individual squared coordinate (f i)² is bounded by the total sum of squares ∑ⱼ (f j)², which is at most 8 by assumption.
uses
Finset.single_le_sum,sq_nonneg,Finset.mem_univhave hsq_le : ∀ i, (f i)^2 ≤ 8 := by intro i have h := Finset.single_le_sum (s := Finset.univ) (f := fun j => (f j)^2) (fun j _ => sq_nonneg (f j)) (Finset.mem_univ i) simpa using h.trans hnorm
Every coordinate f i is either 0, 2, or -2.
Since f i is even, f i = 2k for some integer k. Then (2k)² = 4k² ≤ 8, which forces k² ≤ 2. The only integers satisfying this inequality are k ∈ {-1, 0, 1}, meaning f i = 2k ∈ {-2, 0, 2}.
uses
two_mul,sq_nonneghave hcoord : ∀ i, f i = 0 ∨ f i = 2 ∨ f i = -2 := by intro i obtain ⟨k, hk⟩ := heven i have hx : f i = 2 * k := by rw [hk, two_mul] have hsi : (f i)^2 ≤ 8 := hsq_le i rw [hx] at hsi have hk2 : k^2 ≤ 2 := by nlinarith have hk_low : -1 ≤ k := by nlinarith [sq_nonneg (k+1 : ℤ)] have hk_high : k ≤ 1 := by nlinarith [sq_nonneg (k-1 : ℤ)] rw [hx] interval_cases k <;> simp
For every index in the non-zero support nz = {i | f i ≠ 0}, the squared coordinate (f i)² equals 4.
Any index in nz has f i ≠ 0. Since the only available values for f i are 0, 2, and -2, every element of nz must have f i = 2 or f i = -2, both of which square to 4.
let nz : Finset (Fin n) := Finset.univ.filter (fun i => f i ≠ 0) have hnz_sq : ∀ i ∈ nz, (f i)^2 = 4 := by intro i hi have hneq : f i ≠ 0 := by simpa [nz] using hi rcases hcoord i with h0 | h2 | hm2 · exact absurd h0 hneq · simp [h2] · simp [hm2]
The sum of squared coordinates over the non-zero support nz is 4 * |nz|.
Since every term (f i)² for i ∈ nz is equal to 4, the sum over nz is simply 4 summed |nz| times.
uses
Finset.sum_congr,mul_commhave hsum_sq_nz : (∑ i ∈ nz, (f i)^2) = 4 * (nz.card : ℤ) := by calc (∑ i ∈ nz, (f i)^2) = ∑ i ∈ nz, (4 : ℤ) := by apply Finset.sum_congr rfl intro i hi exact hnz_sq i hi _ = 4 * (nz.card : ℤ) := by simp [mul_comm]
The total sum of squared coordinates over all indices equals the sum over nz.
Coordinates outside nz are zero and contribute nothing to the sum of squares, so restricting the summation to nz leaves the total unchanged.
uses
Finset.sum_filter,Finset.sum_congrhave hsum_sq_univ : (∑ i, (f i)^2) = ∑ i ∈ nz, (f i)^2 := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _ by_cases h : f i = 0 · simp [h] · simp [h]
The non-zero support has at most two elements: |nz| ≤ 2.
Combining the previous equalities gives 4 * |nz| = ∑ᵢ (f i)² ≤ 8, which forces |nz| ≤ 2.
have hcard_le : nz.card ≤ 2 := by have h : 4 * (nz.card : ℤ) ≤ 8 := by rw [← hsum_sq_nz, ← hsum_sq_univ] exact hnorm have h' : (nz.card : ℤ) ≤ 2 := by linarith omega
If |nz| = 0, every coordinate of f is 0.
A cardinality of zero means the support nz is empty, so no index has a non-zero value, establishing that f i = 0 for all i.
uses
Finset.card_eq_zerointerval_cases hc : nz.card · left intro i have hi : i ∉ nz := by rw [Finset.card_eq_zero] at hc rw [hc] simp simpa [nz] using hi
The case |nz| = 1 is impossible.
If nz has exactly one element a, then nz = {a}. The sum of all coordinates would then equal f a, which must be 0 by the zero-sum hypothesis; but an element of nz cannot have coordinate 0, yielding a contradiction.
uses
Finset.card_eq_one.mp,Finset.sum_filter,Finset.sum_congr· exfalso obtain ⟨a, ha⟩ := Finset.card_eq_one.mp hc have hsum_nz : (∑ i, f i) = ∑ i ∈ nz, f i := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _ by_cases h : f i = 0 · simp [h] · simp [h] have hfa : f a = 0 := by rw [hsum_nz, ha] at hsum simpa using hsum have : a ∈ nz := by rw [ha]; simp have hne : f a ≠ 0 := by simpa [nz] using this exact hne hfa
If |nz| = 2, there exist distinct indices with coordinates 2 and -2, and all other coordinates zero.
When nz has two elements, say a and b, the zero-sum condition gives f a + f b = 0. Since f a is non-zero, it must be either 2 or -2. If f a = 2, then f b = -2; if f a = -2, then f b = 2. In either case, one coordinate is 2, the other is -2, and all remaining coordinates outside nz are 0.
uses
Finset.card_eq_two.mp,Finset.sum_filter,Finset.sum_congr,Finset.sum_pair· right obtain ⟨a, b, hab, hset⟩ := Finset.card_eq_two.mp hc have hsum_nz : (∑ i, f i) = ∑ i ∈ nz, f i := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _ by_cases h : f i = 0 · simp [h] · simp [h] have hfab : f a + f b = 0 := by rw [hsum_nz, hset] at hsum rw [Finset.sum_pair hab] at hsum simpa using hsum have ha_mem : a ∈ nz := by rw [hset]; simp have hb_mem : b ∈ nz := by rw [hset]; simp have ha_ne : f a ≠ 0 := by simpa [nz] using ha_mem have hb_ne : f b ≠ 0 := by simpa [nz] using hb_mem rcases hcoord a with ha0 | ha2 | ham2 · exact absurd ha0 ha_ne · have hb2 : f b = -2 := by linarith refine ⟨a, b, hab, ha2, hb2, ?_⟩ intro i hia hib have hin : i ∉ nz := by rw [hset] simp [hia, hib] simpa [nz] using hin · have hb2 : f b = 2 := by linarith refine ⟨b, a, hab.symm, hb2, ham2, ?_⟩ intro i hib hia have hin : i ∉ nz := by rw [hset] simp [hia, hib] simpa [nz] using hin
Finset.single_le_sum- in a sum of non-negative elements over a finite set, any individual element is at most the total sum
Finset.mem_univ- every element of a finite type belongs to its universal finset
sq_nonneg- the square of any real or integer value is non-negative
two_mul- multiplying by 2 is equal to adding a number to itself
Finset.sum_congr- if two sets are equal and the summands agree on every element, their sums are equal
mul_comm- multiplication is commutative
Finset.sum_filter- summing over a filtered sub-finset is equal to summing over the ambient finset with an if-then-else condition
Finset.card_eq_zero- a finite set has cardinality zero if and only if it is empty
Finset.card_eq_one.mp- if a finite set has cardinality one, it is a singleton {a}
Finset.card_eq_two.mp- if a finite set has cardinality two, it consists of two distinct elements {x, y}
Finset.sum_pair- the sum of a function over a two-element set {a, b} with a ≠ b is f(a) + f(b)
- The proof relies on `nlinarith` and `interval_cases` to automatically bound and exhaust the integer possibilities for coordinates, and on `omega` to handle cardinality inequalities across natural numbers and integers.
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.
theorem op_2130_even_zero_sum_two_defects (n : ℕ) (f : Fin n → ℤ) (heven : ∀ i, Even (f i)) (hsum : (∑ i, f i) = 0) (hnorm : (∑ i, (f i)^2) ≤ 8) : (∀ i, f i = 0) ∨ ∃ a b : Fin n, a ≠ b ∧ f a = 2 ∧ f b = -2 ∧ ∀ i, i ≠ a → i ≠ b → f i = 0 := by have hsq_le : ∀ i, (f i)^2 ≤ 8 := by intro i have h := Finset.single_le_sum (s := Finset.univ) (f := fun j => (f j)^2) (fun j _ => sq_nonneg (f j)) (Finset.mem_univ i) simpa using h.trans hnorm have hcoord : ∀ i, f i = 0 ∨ f i = 2 ∨ f i = -2 := by intro i obtain ⟨k, hk⟩ := heven i have hx : f i = 2 * k := by rw [hk, two_mul] have hsi : (f i)^2 ≤ 8 := hsq_le i rw [hx] at hsi have hk2 : k^2 ≤ 2 := by nlinarith have hk_low : -1 ≤ k := by nlinarith [sq_nonneg (k+1 : ℤ)] have hk_high : k ≤ 1 := by nlinarith [sq_nonneg (k-1 : ℤ)] rw [hx] interval_cases k <;> simp let nz : Finset (Fin n) := Finset.univ.filter (fun i => f i ≠ 0) have hnz_sq : ∀ i ∈ nz, (f i)^2 = 4 := by intro i hi have hneq : f i ≠ 0 := by simpa [nz] using hi rcases hcoord i with h0 | h2 | hm2 · exact absurd h0 hneq · simp [h2] · simp [hm2] have hsum_sq_nz : (∑ i ∈ nz, (f i)^2) = 4 * (nz.card : ℤ) := by calc (∑ i ∈ nz, (f i)^2) = ∑ i ∈ nz, (4 : ℤ) := by apply Finset.sum_congr rfl intro i hi exact hnz_sq i hi _ = 4 * (nz.card : ℤ) := by simp [mul_comm] have hsum_sq_univ : (∑ i, (f i)^2) = ∑ i ∈ nz, (f i)^2 := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _ by_cases h : f i = 0 · simp [h] · simp [h] have hcard_le : nz.card ≤ 2 := by have h : 4 * (nz.card : ℤ) ≤ 8 := by rw [← hsum_sq_nz, ← hsum_sq_univ] exact hnorm have h' : (nz.card : ℤ) ≤ 2 := by linarith omega interval_cases hc : nz.card · left intro i have hi : i ∉ nz := by rw [Finset.card_eq_zero] at hc rw [hc] simp simpa [nz] using hi · exfalso obtain ⟨a, ha⟩ := Finset.card_eq_one.mp hc have hsum_nz : (∑ i, f i) = ∑ i ∈ nz, f i := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _ by_cases h : f i = 0 · simp [h] · simp [h] have hfa : f a = 0 := by rw [hsum_nz, ha] at hsum simpa using hsum have : a ∈ nz := by rw [ha]; simp have hne : f a ≠ 0 := by simpa [nz] using this exact hne hfa · right obtain ⟨a, b, hab, hset⟩ := Finset.card_eq_two.mp hc have hsum_nz : (∑ i, f i) = ∑ i ∈ nz, f i := by rw [Finset.sum_filter] apply Finset.sum_congr rfl intro i _ by_cases h : f i = 0 · simp [h] · simp [h] have hfab : f a + f b = 0 := by rw [hsum_nz, hset] at hsum rw [Finset.sum_pair hab] at hsum simpa using hsum have ha_mem : a ∈ nz := by rw [hset]; simp have hb_mem : b ∈ nz := by rw [hset]; simp have ha_ne : f a ≠ 0 := by simpa [nz] using ha_mem have hb_ne : f b ≠ 0 := by simpa [nz] using hb_mem rcases hcoord a with ha0 | ha2 | ham2 · exact absurd ha0 ha_ne · have hb2 : f b = -2 := by linarith refine ⟨a, b, hab, ha2, hb2, ?_⟩ intro i hia hib have hin : i ∉ nz := by rw [hset] simp [hia, hib] simpa [nz] using hin · have hb2 : f b = 2 := by linarith refine ⟨b, a, hab.symm, hb2, ham2, ?_⟩ intro i hib hia have hin : i ∉ nz := by rw [hset] simp [hia, hib] simpa [nz] using hin