op1525_class_imbalance_orientation_card
For more than two signed vertices partitioned into classes, if some class has nonzero signed sum, there is a vertex whose switched class-sum vector cannot be obtained by changing one coordinate of the negated original class-sum vector by either two or minus two.
Statement
theorem op1525_class_imbalance_orientation_card {V J : Type*} [DecidableEq J] [Fintype V] [Fintype J] (cl : V → J) (f : V → ℤ) (hsgn : ∀ v, f v = 1 ∨ f v = -1) (hsize : 2 < Fintype.card V) (hnonzero : ∃ j : J, (∑ v : V, if cl v = j then f v else 0) ≠ 0) : ∃ v : V, ∀ (j : J) (s : ℤ), (s = 1 ∨ s = -1) → ∃ k : J, (∑ u : V, if cl u = k then f u else 0) - 2 * (if cl v = k then f v else 0) ≠ -(∑ u : V, if cl u = k then f u else 0) + 2 * (if j = k then s else 0)
- Source
- A component of the complete-multipartite reconstruction route for OP-1525 and arXiv:2611.13901.
- Verified
- 17 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
The proof argues by contradiction. Assuming no vertex satisfies the condition, every vertex $v$ forces the class-sum vector $D$ to be a signed difference of two indicator functions with weight $f(v)$, which implies that the total signed sum $S = \sum_{v \in V} f(v)$ is zero and that $D(cl(v)) = f(v)$. One then computes the quantity $\sum_{v \in V} f(v) D(cl(v))$ in two different ways: directly as $\sum_{v \in V} (f(v))^2 = |V|$, and by expanding $D$ via a chosen reference vertex $v_0$ to obtain $f(v_0)(D(cl(v_0)) - D(j_0)) = 2 (f(v_0))^2 = 2$. Equating these two evaluations forces $|V| = 2$, which contradicts the hypothesis that $|V| > 2$.
Define the class-sum vector $D$ and total sum $S$, and assume the negation of the theorem for contradiction.
Let $D(j) = \sum_{v \in V, cl(v) = j} f(v)$ denote the signed sum of class $j$, and let $S = \sum_{v \in V} f(v)$ denote the total sum of all vertex signs. The assumption that some class sum is nonzero translates to $\exists j, D(j) \neq 0$. We assume for contradiction that for every vertex $v \in V$, there exist a class $j \in J$ and sign $s \in \{1, -1\}$ such that for every class $k \in J$, the switched class sum $D(k) - 2 \cdot [cl(v) = k] f(v)$ equals $-D(k) + 2 \cdot [j = k] s$.
classical let D : J → ℤ := fun j => ∑ v : V, if cl v = j then f v else 0 let S : ℤ := ∑ v : V, f v change (∃ j, D j ≠ 0) at hnonzero change ∃ v, ∀ j s, (s = 1 ∨ s = -1) → ∃ k, D k - 2 * (if cl v = k then f v else 0) ≠ -D k + 2 * (if j = k then s else 0) by_contra H push_neg at H
The sum of all class sums equals the total sum of all vertex signs: $\sum_{j \in J} D(j) = S$.
Unfolding the definitions, $\sum_{j \in J} D(j) = \sum_{j \in J} \sum_{v \in V} [cl(v) = j] f(v)$. Swapping the order of summation using Finset.sum_comm, the inner sum over $j$ collapses to $f(v)$ for the unique class $j = cl(v)$, leaving $\sum_{v \in V} f(v) = S$.
uses
Finset.sum_commhave hDsum : (∑ j : J, D j) = S := by dsimp [D, S] rw [Finset.sum_comm] simp
For each vertex $v$, there exist a class $j \in J$ and sign $s \in \{1, -1\}$ such that for all $k \in J$, $D(k) = [cl(v) = k] f(v) + [j = k] s$.
From the contradiction hypothesis for vertex $v$, we have $D(k) - 2 \cdot [cl(v) = k] f(v) = -D(k) + 2 \cdot [j = k] s$. Rearranging by linear integer arithmetic gives $2 D(k) = 2 \cdot [cl(v) = k] f(v) + 2 \cdot [j = k] s$, which upon dividing by 2 yields the claim.
have hu (v : V) : ∃ j : J, ∃ s : ℤ, (s = 1 ∨ s = -1) ∧ ∀ k : J, D k = (if cl v = k then f v else 0) + (if j = k then s else 0) := by obtain ⟨j,s,hs,hall⟩ := H v refine ⟨j,s,hs,?_⟩ intro k have hk := hall k omega
For every vertex $v$, the total sum satisfies $S = f(v) + s$ for some $s \in \{1, -1\}$.
Summing the coordinate-wise formula $D(k) = [cl(v) = k] f(v) + [j = k] s$ over all $k \in J$, we apply Finset.sum_congr and distribute the sum using Finset.sum_add_distrib. Since $cl(v)$ and $j$ each equal $k$ for exactly one class $k \in J$, the two sums evaluate to $f(v)$ and $s$, yielding $S = f(v) + s$.
uses
Finset.sum_congr,Finset.sum_add_distrib,eq_commhave hsum (v : V) : ∃ s : ℤ, (s = 1 ∨ s = -1) ∧ S = f v + s := by obtain ⟨j,s,hs,hall⟩ := hu v refine ⟨s,hs,?_⟩ calc S = ∑ k : J, D k := hDsum.symm _ = ∑ k : J, ((if cl v = k then f v else 0) + (if j = k then s else 0)) := by apply Finset.sum_congr rfl intro k _ exact hall k _ = f v + s := by simp [Finset.sum_add_distrib, eq_comm]
The total sum $S$ is restricted to $S \in \{0, 2, -2\}$.
Because $|V| > 2 > 0$, the type $V$ is nonempty by Fintype.card_pos_iff.mp, so we choose a reference vertex $v_0 \in V$ using Classical.choice. Since $S = f(v_0) + s$ with $f(v_0) \in \{1, -1\}$ and $s \in \{1, -1\}$, checking all four sign combinations shows that $S$ must be 0, 2, or -2.
uses
Fintype.card_pos_iff.mp,Classical.choicehave hnonempty : Nonempty V := Fintype.card_pos_iff.mp (by omega) let v0 : V := Classical.choice hnonempty have hcases : S = 0 ∨ S = 2 ∨ S = -2 := by obtain ⟨s, hs, heq⟩ := hsum v0 rcases hsgn v0 with h | h <;> rcases hs with hs | hs <;> omega
The total sum $S$ must be 0.
If $S = 2$, then for every $v \in V$, the equation $2 = f(v) + s$ with $f(v), s \in \{1, -1\}$ forces $f(v) = 1$ and $s = 1$. This implies that every vertex has sign 1, so $S = \sum_{v \in V} 1 = |V| > 2$, a contradiction. Symmetrically, if $S = -2$, then $f(v) = -1$ for all $v$, which implies $S = -|V| < -2$, another contradiction. Hence, $S = 0$.
have hS : S = 0 := by rcases hcases with hz | hp | hn · exact hz · have hall : ∀ v, f v = 1 := by intro v obtain ⟨s,hs,heq⟩ := hsum v rcases hsgn v with h | h <;> rcases hs with hs | hs <;> omega have hcard : S = (Fintype.card V : ℤ) := by simp [S, hall] omega · have hall : ∀ v, f v = -1 := by intro v obtain ⟨s,hs,heq⟩ := hsum v rcases hsgn v with h | h <;> rcases hs with hs | hs <;> omega have hcard : S = -(Fintype.card V : ℤ) := by simp [S, hall] omega
For each vertex $v$, there exists a distinct class $j \neq cl(v)$ such that $D(k) = [cl(v) = k] f(v) - [j = k] f(v)$ for all $k \in J$.
From $S = f(v) + s$ and $S = 0$, we deduce $s = -f(v)$. Substituting this into the formula for $D(k)$ gives $D(k) = [cl(v) = k] f(v) - [j = k] f(v)$. If $j = cl(v)$, then $D(k) = 0$ for all $k \in J$, which would contradict the hypothesis that at least one class sum is nonzero. Hence, $j \neq cl(v)$.
uses
Finset.sum_congr,Finset.sum_add_distrib,eq_commhave hdiff (v : V) : ∃ j : J, j ≠ cl v ∧ ∀ k : J, D k = (if cl v = k then f v else 0) - (if j = k then f v else 0) := by obtain ⟨j,s,hs,hall⟩ := hu v have hSv : S = f v + s := by calc S = ∑ k : J, D k := hDsum.symm _ = ∑ k : J, ((if cl v = k then f v else 0) + (if j = k then s else 0)) := by apply Finset.sum_congr rfl intro k _ exact hall k _ = f v + s := by simp [Finset.sum_add_distrib, eq_comm] have hsneg : s = -f v := by omega have hd (k : J) : D k = (if cl v = k then f v else 0) - (if j = k then f v else 0) := by rw [hall k, hsneg] split_ifs <;> ring have hj : j ≠ cl v := by intro hj obtain ⟨k,hk⟩ := hnonzero have hz := hd k simp [hj] at hz exact hk hz exact ⟨j,hj,hd⟩
For every vertex $v$, the sum of its own class is its own sign: $D(cl(v)) = f(v)$.
Evaluating the difference formula for $D(k)$ at $k = cl(v)$, the second indicator $[j = cl(v)]$ vanishes because $j \neq cl(v)$, leaving $D(cl(v)) = f(v)$.
have hdiag (v : V) : D (cl v) = f v := by obtain ⟨j,hj,hd⟩ := hdiff v simpa [hj] using hd (cl v)
The inner product $\sum_{v \in V} f(v) D(cl(v))$ equals the vertex count $|V|$.
Because $f(v) \in \{1, -1\}$, we have $(f(v))^2 = 1$. Using $D(cl(v)) = f(v)$, each summand satisfies $f(v) D(cl(v)) = f(v)^2 = 1$. Summing the constant 1 over all $v \in V$ yields $|V|$.
uses
Finset.sum_const_zero,Finset.sum_const,Finset.card_univ,nsmul_eq_mul,mul_onehave hsq (v : V) : f v * f v = 1 := by rcases hsgn v with h | h <;> rw [h] <;> norm_num have hsum1 : (∑ v : V, f v * D (cl v)) = (Fintype.card V : ℤ) := by simp only [hdiag, hsq, Finset.sum_const_zero, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one]
The inner product can also be expressed through $v_0$ as $\sum_{v \in V} f(v) D(cl(v)) = f(v_0) (D(cl(v_0)) - D(j_0))$.
For the chosen vertex $v_0$ and its associated class $j_0$, we have $D(k) = f(v_0) ([cl(v_0) = k] - [j_0 = k])$ for all $k$. Evaluating this at $k = cl(v)$ inside the sum and distributing, the sum splits into $f(v_0)$ times the difference $\sum_{v : cl(v) = cl(v_0)} f(v) - \sum_{v : cl(v) = j_0} f(v)$, which by definition equals $f(v_0) (D(cl(v_0)) - D(j_0))$.
uses
mul_sub,Finset.mul_sum,Finset.sum_sub_distrib,Finset.sum_congr,mul_ite,mul_zero,eq_comm,mul_commobtain ⟨j0,hj0,hd0⟩ := hdiff v0 have hsum2 : (∑ v : V, f v * D (cl v)) = f v0 * (D (cl v0) - D j0) := by change (∑ v : V, f v * D (cl v)) = f v0 * ((∑ v : V, if cl v = cl v0 then f v else 0) - (∑ v : V, if cl v = j0 then f v else 0)) rw [mul_sub, Finset.mul_sum, Finset.mul_sum, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro v _ rw [hd0 (cl v)] simp only [mul_sub, mul_ite, mul_zero] simp [eq_comm, mul_comm]
The class sum at $j_0$ is $D(j_0) = -f(v_0)$.
Evaluating the formula for $D(k)$ associated with $v_0$ at $k = j_0$, the first indicator $[cl(v_0) = j_0]$ is 0 because $j_0 \neq cl(v_0)$ by Ne.symm, which leaves $D(j_0) = -f(v_0)$.
uses
Ne.symmhave hjval : D j0 = -f v0 := by have h := hd0 j0 simpa [hj0, Ne.symm hj0] using h
Equating the two evaluations shows $|V| = 2$, contradicting $|V| > 2$.
Since $D(cl(v_0)) = f(v_0)$ and $D(j_0) = -f(v_0)$, their difference is $2 f(v_0)$. The second evaluation of the inner product becomes $f(v_0) \cdot 2 f(v_0) = 2 (f(v_0))^2 = 2$. Equating this to the first evaluation gives $|V| = 2$, which directly contradicts the assumption that $|V| > 2$.
have hsquare := hsq v0 rw [hdiag v0, hjval] at hsum2 have hc : (Fintype.card V : ℤ) = 2 := by nlinarith [hsum1, hsum2, hsquare] omega
Finset.sum_comm- Exchanging the order of two finite summations does not change the sum.
Finset.sum_congr- Two finite sums are equal if their index sets are equal and their summands are pointwise equal on the index set.
Finset.sum_add_distrib- The sum of a sum of functions over a finite set equals the sum of their individual sums.
eq_comm- Equality is symmetric ($a = b \leftrightarrow b = a$).
Fintype.card_pos_iff.mp- A finite type with strictly positive cardinality is nonempty.
Classical.choice- Extracts an arbitrary element from a nonempty type.
Finset.sum_const_zero- The sum of the constant zero over any finite set is zero.
Finset.sum_const- Summing a constant value $b$ over a finite set $s$ equals the cardinality of $s$ multiplied by $b$.
Finset.card_univ- The cardinality of the universal finset of a finite type is the cardinality of the type.
nsmul_eq_mul- Scalar multiplication by a natural number $n$ equals algebraic multiplication by $n$.
mul_one- Multiplying any element by 1 leaves it unchanged.
mul_sub- Multiplication distributes over subtraction from the left: $a(b - c) = ab - ac$.
Finset.mul_sum- Multiplication by a scalar or constant distributes over a finite sum.
Finset.sum_sub_distrib- The sum of a difference over a finite set is the difference of the sums.
mul_ite- Multiplication distributes into both branches of an if-then-else expression.
mul_zero- Multiplying any element by 0 gives 0.
mul_comm- Multiplication is commutative ($ab = ba$).
Ne.symm- Inequality is symmetric ($a \neq b \implies b \neq a$).
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 op1525_class_imbalance_orientation_card {V J : Type*} [DecidableEq J] [Fintype V] [Fintype J] (cl : V → J) (f : V → ℤ) (hsgn : ∀ v, f v = 1 ∨ f v = -1) (hsize : 2 < Fintype.card V) (hnonzero : ∃ j : J, (∑ v : V, if cl v = j then f v else 0) ≠ 0) : ∃ v : V, ∀ (j : J) (s : ℤ), (s = 1 ∨ s = -1) → ∃ k : J, (∑ u : V, if cl u = k then f u else 0) - 2 * (if cl v = k then f v else 0) ≠ -(∑ u : V, if cl u = k then f u else 0) + 2 * (if j = k then s else 0) := by classical let D : J → ℤ := fun j => ∑ v : V, if cl v = j then f v else 0 let S : ℤ := ∑ v : V, f v change (∃ j, D j ≠ 0) at hnonzero change ∃ v, ∀ j s, (s = 1 ∨ s = -1) → ∃ k, D k - 2 * (if cl v = k then f v else 0) ≠ -D k + 2 * (if j = k then s else 0) by_contra H push_neg at H have hDsum : (∑ j : J, D j) = S := by dsimp [D, S] rw [Finset.sum_comm] simp have hu (v : V) : ∃ j : J, ∃ s : ℤ, (s = 1 ∨ s = -1) ∧ ∀ k : J, D k = (if cl v = k then f v else 0) + (if j = k then s else 0) := by obtain ⟨j,s,hs,hall⟩ := H v refine ⟨j,s,hs,?_⟩ intro k have hk := hall k omega have hsum (v : V) : ∃ s : ℤ, (s = 1 ∨ s = -1) ∧ S = f v + s := by obtain ⟨j,s,hs,hall⟩ := hu v refine ⟨s,hs,?_⟩ calc S = ∑ k : J, D k := hDsum.symm _ = ∑ k : J, ((if cl v = k then f v else 0) + (if j = k then s else 0)) := by apply Finset.sum_congr rfl intro k _ exact hall k _ = f v + s := by simp [Finset.sum_add_distrib, eq_comm] have hnonempty : Nonempty V := Fintype.card_pos_iff.mp (by omega) let v0 : V := Classical.choice hnonempty have hcases : S = 0 ∨ S = 2 ∨ S = -2 := by obtain ⟨s, hs, heq⟩ := hsum v0 rcases hsgn v0 with h | h <;> rcases hs with hs | hs <;> omega have hS : S = 0 := by rcases hcases with hz | hp | hn · exact hz · have hall : ∀ v, f v = 1 := by intro v obtain ⟨s,hs,heq⟩ := hsum v rcases hsgn v with h | h <;> rcases hs with hs | hs <;> omega have hcard : S = (Fintype.card V : ℤ) := by simp [S, hall] omega · have hall : ∀ v, f v = -1 := by intro v obtain ⟨s,hs,heq⟩ := hsum v rcases hsgn v with h | h <;> rcases hs with hs | hs <;> omega have hcard : S = -(Fintype.card V : ℤ) := by simp [S, hall] omega have hdiff (v : V) : ∃ j : J, j ≠ cl v ∧ ∀ k : J, D k = (if cl v = k then f v else 0) - (if j = k then f v else 0) := by obtain ⟨j,s,hs,hall⟩ := hu v have hSv : S = f v + s := by calc S = ∑ k : J, D k := hDsum.symm _ = ∑ k : J, ((if cl v = k then f v else 0) + (if j = k then s else 0)) := by apply Finset.sum_congr rfl intro k _ exact hall k _ = f v + s := by simp [Finset.sum_add_distrib, eq_comm] have hsneg : s = -f v := by omega have hd (k : J) : D k = (if cl v = k then f v else 0) - (if j = k then f v else 0) := by rw [hall k, hsneg] split_ifs <;> ring have hj : j ≠ cl v := by intro hj obtain ⟨k,hk⟩ := hnonzero have hz := hd k simp [hj] at hz exact hk hz exact ⟨j,hj,hd⟩ have hdiag (v : V) : D (cl v) = f v := by obtain ⟨j,hj,hd⟩ := hdiff v simpa [hj] using hd (cl v) have hsq (v : V) : f v * f v = 1 := by rcases hsgn v with h | h <;> rw [h] <;> norm_num have hsum1 : (∑ v : V, f v * D (cl v)) = (Fintype.card V : ℤ) := by simp only [hdiag, hsq, Finset.sum_const_zero, Finset.sum_const, Finset.card_univ, nsmul_eq_mul, mul_one] obtain ⟨j0,hj0,hd0⟩ := hdiff v0 have hsum2 : (∑ v : V, f v * D (cl v)) = f v0 * (D (cl v0) - D j0) := by change (∑ v : V, f v * D (cl v)) = f v0 * ((∑ v : V, if cl v = cl v0 then f v else 0) - (∑ v : V, if cl v = j0 then f v else 0)) rw [mul_sub, Finset.mul_sum, Finset.mul_sum, ← Finset.sum_sub_distrib] apply Finset.sum_congr rfl intro v _ rw [hd0 (cl v)] simp only [mul_sub, mul_ite, mul_zero] simp [eq_comm, mul_comm] have hjval : D j0 = -f v0 := by have h := hd0 j0 simpa [hj0, Ne.symm hj0] using h have hsquare := hsq v0 rw [hdiag v0, hjval] at hsum2 have hc : (Fintype.card V : ℤ) = 2 := by nlinarith [hsum1, hsum2, hsquare] omega