cyclic_cubic_parity_repr_ortho
Every parity representation S of cyclic_cubic_syndrome n satisfies ∑_{y ∈ S} (∑_{j ∈ y} c_j)(∑_{k ∈ y} d_k) = 0 and ∑_{y ∈ S} ∑_{j ∈ y} c_j = 0, because singletons and pairs have cyclic cubic syndrome 0.
Statement
theorem cyclic_cubic_parity_repr_ortho (n : ℕ) (hn : 6 ≤ n) (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (cyclic_cubic_syndrome n)) (c d : Fin n → ZMod 2) : (∑ y ∈ S, (∑ j ∈ y, c j) * (∑ k ∈ y, d k) = 0) ∧ (∑ y ∈ S, (∑ j ∈ y, c j) = 0)- Source
- step towards cyclic_cubic_t_count_isotropy_lower_bound
- Verified
- 30 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- is_parity_reprA finite set S of nonempty parities on n qubits is a parity representation of a syndrome s if the moment of S at every non-empty subset A…
- cyclic_cubic_syndromeFor a natural number n and a finite subset A of Fin n, cyclic_cubic_syndrome n A returns 1 in ZMod 2 if there exists j : Fin n such that A…
- Used by 2
- cyclic_cubic_parity_repr_pair_sumFor n ≥ 6 and any distinct pair p ≠ q, the sum ∑_j c_j * s({j, p, q}) vanishes for any affine evaluation on a parity representation.
- cyclic_cubic_t_count_isotropy_lower_boundFor every natural number n ≥ 6 and every finite set S : Finset (Finset (Fin n)), if is_parity_repr S (cyclic_cubic_syndrome n), then 2 * n…
The proof, explained
The proof establishes that for n ≥ 6, any subset A of cardinality at most 2 has cyclic cubic syndrome 0, because the syndrome only flags triples {j, j+1, j+2} modulo n, which have cardinality 3. Consequently, in any parity representation S, the number of subsets containing any fixed singleton or pair is even. Expanding the bilinear and linear forms over S and exchanging summation order expresses both as linear combinations of these counts modulo 2, so every term vanishes.
For any j ∈ Fin n, the three cyclic elements j₀ = j, j₁ = (j + 1) % n, and j₂ = (j + 2) % n are pairwise distinct.
Fix j ∈ Fin n. Since n ≥ 6, we first compute (n + 1) % n = 1. To show j₀ ≠ j₁, suppose j = (j + 1) % n. If j + 1 < n, then j = j + 1, a contradiction. If j + 1 ≥ n, then since j < n we must have j + 1 = n, so (j + 1) % n = 0, which implies j = 0 and thus n = 1, contradicting n ≥ 6. To show j₀ ≠ j₂, the equality j = (j + 2) % n splits into cases: j + 2 < n gives j = j + 2, impossible; j + 2 = n gives j = 0 and n = 2, contradicting n ≥ 6; and j + 2 = n + 1 gives j = 1 and n = 2, again contradicting n ≥ 6. Finally, j₁ ≠ j₂ follows by a similar case analysis on j + 2 < n, j + 2 = n, and j + 2 = n + 1.
uses
Nat.mod_lt,add_comm,Nat.add_mod_right,Nat.mod_eq_of_lt,congr_arg,Nat.mod_selflemma cyclic_cubic_parity_repr_ortho_syndrome_card_le_two (n : ℕ) (hn : 6 ≤ n) (A : Finset (Fin n)) (hA : A.card ≤ 2) : cyclic_cubic_syndrome n A = 0 := by have h_triple_card : ∀ j : Fin n, ({j, ⟨(j.val + 1) % n, Nat.mod_lt _ (by omega)⟩, ⟨(j.val + 2) % n, Nat.mod_lt _ (by omega)⟩} : Finset (Fin n)).card = 3 := by intro j let j0 : Fin n := j let j1 : Fin n := ⟨(j.val + 1) % n, Nat.mod_lt _ (by omega)⟩ let j2 : Fin n := ⟨(j.val + 2) % n, Nat.mod_lt _ (by omega)⟩ have hj := j.isLt have h_n_add_one : (n + 1) % n = 1 := by rw [add_comm, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] have h01 : j0 ≠ j1 := by intro h have hval := congr_arg Fin.val h dsimp [j0, j1] at hval by_cases hj1 : j.val + 1 < n · rw [Nat.mod_eq_of_lt hj1] at hval; omega · have hj2 : j.val + 1 = n := by omega rw [hj2, Nat.mod_self] at hval; omega have h02 : j0 ≠ j2 := by intro h have hval := congr_arg Fin.val h dsimp [j0, j2] at hval by_cases hj1 : j.val + 2 < n · rw [Nat.mod_eq_of_lt hj1] at hval; omega · have hj2 : j.val + 2 = n ∨ j.val + 2 = n + 1 := by omega rcases hj2 with h2 | h2 · rw [h2, Nat.mod_self] at hval; omega · rw [h2, h_n_add_one] at hval; omega have h12 : j1 ≠ j2 := by intro h have hval := congr_arg Fin.val h dsimp [j1, j2] at hval by_cases hj2 : j.val + 2 < n · have hj1 : j.val + 1 < n := by omega rw [Nat.mod_eq_of_lt hj1, Nat.mod_eq_of_lt hj2] at hval; omega · have hjcase : j.val + 2 = n ∨ j.val + 2 = n + 1 := by omega rcases hjcase with h2 | h2 · have hj1 : j.val + 1 < n := by omega rw [Nat.mod_eq_of_lt hj1, h2, Nat.mod_self] at hval; omega · have hj1 : j.val + 1 = n := by omega rw [hj1, Nat.mod_self, h2, h_n_add_one] at hval; omega
The triple {j, (j + 1) % n, (j + 2) % n} has cardinality 3.
Because j₁ ∉ {j₂} (as j₁ ≠ j₂) and j₀ ∉ {j₁, j₂} (as j₀ ≠ j₁ and j₀ ≠ j₂), inserting elements successively into the singleton {j₂} increments the cardinality from 1 to 2, and then to 3.
uses
Finset.card_insert_of_notMem,Finset.card_singleton,Finset.mem_singleton,Finset.mem_insertchange ({j0, j1, j2} : Finset (Fin n)).card = 3 rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton] · intro h; simp only [Finset.mem_singleton] at h; exact h12 h · simp only [Finset.mem_insert, Finset.mem_singleton]; rintro (h | h) · exact h01 h · exact h02 h
Any subset A ⊆ Fin n with |A| ≤ 2 satisfies cyclic_cubic_syndrome n A = 0.
Unfolding the definition of cyclic_cubic_syndrome, it returns 1 if A is a triple of the form {j, (j + 1) % n, (j + 2) % n} and 0 otherwise. If A were such a triple, its cardinality would be 3 by the preceding step, contradicting |A| ≤ 2. Hence A cannot be such a triple, and the syndrome is 0.
unfold cyclic_cubic_syndrome split_ifs with h · rcases h with ⟨j, rfl⟩ have hc := h_triple_card j omega · rfl
For any parity representation S of cyclic_cubic_syndrome n and any subset A with 1 ≤ |A| ≤ 2, the number of sets in S containing A is 0 mod 2.
By the definition of a parity representation (is_parity_repr), for any set A with 1 ≤ |A| ≤ 3, the count |{y ∈ S | A ⊆ y}| mod 2 equals cyclic_cubic_syndrome n A. Since |A| ≤ 2, this syndrome is 0 by cyclic_cubic_parity_repr_ortho_syndrome_card_le_two.
uses
cyclic_cubic_parity_repr_ortho_syndrome_card_le_twolemma cyclic_cubic_parity_repr_ortho_card_le_two (n : ℕ) (hn : 6 ≤ n) (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (cyclic_cubic_syndrome n)) (A : Finset (Fin n)) (hA1 : 1 ≤ A.card) (hA2 : A.card ≤ 2) : ((S.filter (fun y => A ⊆ y)).card : ZMod 2) = 0 := by have hr := hS.2 A ⟨hA1, by omega⟩ rw [hr, cyclic_cubic_parity_repr_ortho_syndrome_card_le_two n hn A hA2]
It suffices to prove the quadratic orthogonality relation and the linear sum relation separately.
Applying constructor splits the conjunction into two separate goals: ∑_{y ∈ S} (∑_{j ∈ y} c_j)(∑_{k ∈ y} d_k) = 0 and ∑_{y ∈ S} ∑_{j ∈ y} c_j = 0.
theorem cyclic_cubic_parity_repr_ortho (n : ℕ) (hn : 6 ≤ n) (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (cyclic_cubic_syndrome n)) (c d : Fin n → ZMod 2) : (∑ y ∈ S, (∑ j ∈ y, c j) * (∑ k ∈ y, d k) = 0) ∧ (∑ y ∈ S, (∑ j ∈ y, c j) = 0) := by constructor
The quadratic sum vanishes if for all j, k ∈ Fin n, the inner sum ∑_{y ∈ S} [j ∈ y] c_j [k ∈ y] d_k is zero.
Each restricted sum ∑_{j ∈ y} c_j is rewritten over all j ∈ Fin n using indicator functions (if j ∈ y then c_j else 0). Multiplying the two sums gives a double sum over j and k. Interchanging the order of summation brings the sums over j and k to the outside, so by Finset.sum_eq_zero it suffices to show that the inner sum over y ∈ S vanishes for every pair (j, k).
uses
Finset.sum_congr,Finset.sum_ite_mem_eq,Finset.sum_mul_sum,Finset.sum_comm,Finset.sum_eq_zero· have h1 : (∑ y ∈ S, (∑ j ∈ y, c j) * (∑ k ∈ y, d k)) = ∑ y ∈ S, ∑ j : Fin n, ∑ k : Fin n, (if j ∈ y then c j else 0) * (if k ∈ y then d k else 0) := by refine Finset.sum_congr rfl (fun y _ => ?_) rw [← Finset.sum_ite_mem_eq y c, ← Finset.sum_ite_mem_eq y d] rw [Finset.sum_mul_sum] rw [h1, Finset.sum_comm] refine Finset.sum_eq_zero (fun j _ => ?_) rw [Finset.sum_comm] refine Finset.sum_eq_zero (fun k _ => ?_)
For fixed j and k, the sum over y ∈ S equals c_j * d_k * |{y ∈ S | {j, k} ⊆ y}| mod 2.
Factoring c_j * d_k out of the sum over y ∈ S leaves the sum of indicators [j ∈ y ∧ k ∈ y], verified by testing all four truth assignments for j ∈ y and k ∈ y. By Finset.sum_boole, this sum equals the cardinality of {y ∈ S | j ∈ y ∧ k ∈ y} mod 2, which is the same as the set of y ∈ S containing the pair {j, k}.
uses
Finset.mul_sum,Finset.sum_congr,Finset.sum_boole,Finset.mem_filter,Finset.insert_subset_iff,Finset.singleton_subset_iffhave h_split : (∑ y ∈ S, (if j ∈ y then c j else 0) * (if k ∈ y then d k else 0)) = (c j * d k) * ∑ y ∈ S, (if j ∈ y ∧ k ∈ y then (1 : ZMod 2) else 0) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun y _ => ?_) by_cases hj : j ∈ y <;> by_cases hk : k ∈ y <;> simp [hj, hk] rw [h_split, Finset.sum_boole] have h_filt : {x ∈ S | j ∈ x ∧ k ∈ x} = S.filter (fun y => {j, k} ⊆ y) := by ext y simp only [Finset.mem_filter, Finset.insert_subset_iff, Finset.singleton_subset_iff] rw [h_filt]
The inner sum vanishes for every pair (j, k), establishing ∑_{y ∈ S} (∑_{j ∈ y} c_j)(∑_{k ∈ y} d_k) = 0.
The set {j, k} contains j, so it is nonempty (cardinality ≥ 1), and inserting j into {k} gives cardinality at most 2. By cyclic_cubic_parity_repr_ortho_card_le_two, the number of y ∈ S containing {j, k} is 0 mod 2. Multiplying by c_j * d_k gives 0.
uses
Finset.mem_insert_self,Finset.Nonempty.card_pos,Finset.card_insert_le,Finset.card_singleton,cyclic_cubic_parity_repr_ortho_card_le_two,mul_zerohave hne : ({j, k} : Finset (Fin n)).Nonempty := ⟨j, Finset.mem_insert_self j _⟩ have hcard1 : 1 ≤ ({j, k} : Finset (Fin n)).card := Finset.Nonempty.card_pos hne have hcard2 : ({j, k} : Finset (Fin n)).card ≤ 2 := by have := Finset.card_insert_le j {k} rw [Finset.card_singleton] at this omega have h_zero := cyclic_cubic_parity_repr_ortho_card_le_two n hn S hS {j, k} hcard1 hcard2 rw [h_zero, mul_zero]
The linear sum vanishes if for every j ∈ Fin n, the inner sum ∑_{y ∈ S} [j ∈ y] c_j is zero.
The sum ∑_{j ∈ y} c_j is rewritten over all j ∈ Fin n using indicator functions. Swapping the summation order over y and j, it suffices by Finset.sum_eq_zero to show the inner sum over y ∈ S vanishes for each j.
uses
Finset.sum_congr,Finset.sum_ite_mem_eq,Finset.sum_comm,Finset.sum_eq_zero· have h1 : (∑ y ∈ S, ∑ j ∈ y, c j) = ∑ y ∈ S, ∑ j : Fin n, if j ∈ y then c j else 0 := by refine Finset.sum_congr rfl (fun y _ => ?_) exact (Finset.sum_ite_mem_eq y c).symm rw [h1, Finset.sum_comm] refine Finset.sum_eq_zero (fun j _ => ?_)
For fixed j, the sum over y ∈ S equals c_j * |{y ∈ S | {j} ⊆ y}| mod 2.
Factoring c_j out leaves ∑_{y ∈ S} [j ∈ y], which equals |{y ∈ S | j ∈ y}| mod 2 by Finset.sum_boole. An element j belongs to y if and only if the singleton {j} is a subset of y.
uses
Finset.mul_sum,Finset.sum_congr,Finset.sum_boole,Finset.mem_filter,Finset.singleton_subset_iffhave h_split : (∑ y ∈ S, if j ∈ y then c j else 0) = c j * ∑ y ∈ S, (if j ∈ y then (1 : ZMod 2) else 0) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun y _ => ?_) split_ifs <;> ring rw [h_split, Finset.sum_boole] have h_filt : {x ∈ S | j ∈ x} = S.filter (fun y => {j} ⊆ y) := by ext y simp only [Finset.mem_filter, Finset.singleton_subset_iff] rw [h_filt]
The inner sum vanishes for every j, establishing ∑_{y ∈ S} ∑_{j ∈ y} c_j = 0.
The singleton {j} has cardinality 1, which satisfies 1 ≤ |{j}| ≤ 2. By cyclic_cubic_parity_repr_ortho_card_le_two, the number of y ∈ S containing {j} is 0 mod 2. Multiplying by c_j gives 0, completing the proof.
uses
Finset.card_singleton,cyclic_cubic_parity_repr_ortho_card_le_two,mul_zerohave hcard1 : 1 ≤ ({j} : Finset (Fin n)).card := by rw [Finset.card_singleton] have hcard2 : ({j} : Finset (Fin n)).card ≤ 2 := by rw [Finset.card_singleton]; omega have h_zero := cyclic_cubic_parity_repr_ortho_card_le_two n hn S hS {j} hcard1 hcard2 rw [h_zero, mul_zero]
Nat.mod_lt- For positive y, x % y < y.
add_comm- Addition is commutative: a + b = b + a.
Nat.add_mod_right- For natural numbers, (x + z) % z = x % z.
Nat.mod_eq_of_lt- If a < b, then a % b = a.
congr_arg- Equality is preserved under function application: a₁ = a₂ implies f(a₁) = f(a₂).
Nat.mod_self- For any natural number n, n % n = 0.
Finset.card_insert_of_notMem- Inserting an element not already in a finite set increases its cardinality by 1.
Finset.card_singleton- A singleton set has cardinality 1.
Finset.mem_singleton- An element is in the singleton {a} if and only if it equals a.
Finset.mem_insert- An element is in insert b s if and only if it equals b or is in s.
cyclic_cubic_parity_repr_ortho_syndrome_card_le_two- For n ≥ 6, any subset A ⊆ Fin n with |A| ≤ 2 has cyclic cubic syndrome 0.
Finset.sum_congr- Two sums over equal finite sets of pointwise equal functions are equal.
Finset.sum_ite_mem_eq- Summing an indicator (f(i) if i ∈ s else 0) over the entire universe equals the sum of f(i) over s.
Finset.sum_mul_sum- The product of two finite sums equals the double sum of their pointwise products.
Finset.sum_comm- The order of two finite summations can be interchanged.
Finset.sum_eq_zero- A finite sum whose terms are all zero equals zero.
Finset.mul_sum- Multiplication distributes over finite sums: a * ∑ i, f(i) = ∑ i, a * f(i).
Finset.sum_boole- Summing a boolean predicate indicator (1 if p(x) else 0) over a finite set equals the cardinality of the filtered subset.
Finset.mem_filter- An element belongs to {x ∈ s | p x} if and only if it belongs to s and satisfies p.
Finset.insert_subset_iff- insert a s ⊆ t if and only if a ∈ t and s ⊆ t.
Finset.singleton_subset_iff- The singleton {a} is a subset of s if and only if a ∈ s.
Finset.mem_insert_self- An element a belongs to insert a s.
Finset.Nonempty.card_pos- A nonempty finite set has strictly positive cardinality.
Finset.card_insert_le- The cardinality of insert a s is at most 1 + the cardinality of s.
cyclic_cubic_parity_repr_ortho_card_le_two- In a parity representation S of cyclic_cubic_syndrome n with n ≥ 6, the number of sets in S containing any set A of size 1 or 2 is even (0 mod 2).
mul_zero- Multiplying any element by zero yields zero: a * 0 = 0.
- Restricted sums over subsets y ⊆ Fin n (such as ∑_{j ∈ y} c_j) are formalized as sums over the universe Fin n using indicator functions (if j ∈ y then c j else 0), which allows Lean's sum-commutation lemmas to exchange the summation order with the outer sum over S.
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.
lemma cyclic_cubic_parity_repr_ortho_syndrome_card_le_two (n : ℕ) (hn : 6 ≤ n) (A : Finset (Fin n)) (hA : A.card ≤ 2) : cyclic_cubic_syndrome n A = 0 := by have h_triple_card : ∀ j : Fin n, ({j, ⟨(j.val + 1) % n, Nat.mod_lt _ (by omega)⟩, ⟨(j.val + 2) % n, Nat.mod_lt _ (by omega)⟩} : Finset (Fin n)).card = 3 := by intro j let j0 : Fin n := j let j1 : Fin n := ⟨(j.val + 1) % n, Nat.mod_lt _ (by omega)⟩ let j2 : Fin n := ⟨(j.val + 2) % n, Nat.mod_lt _ (by omega)⟩ have hj := j.isLt have h_n_add_one : (n + 1) % n = 1 := by rw [add_comm, Nat.add_mod_right, Nat.mod_eq_of_lt (by omega)] have h01 : j0 ≠ j1 := by intro h have hval := congr_arg Fin.val h dsimp [j0, j1] at hval by_cases hj1 : j.val + 1 < n · rw [Nat.mod_eq_of_lt hj1] at hval; omega · have hj2 : j.val + 1 = n := by omega rw [hj2, Nat.mod_self] at hval; omega have h02 : j0 ≠ j2 := by intro h have hval := congr_arg Fin.val h dsimp [j0, j2] at hval by_cases hj1 : j.val + 2 < n · rw [Nat.mod_eq_of_lt hj1] at hval; omega · have hj2 : j.val + 2 = n ∨ j.val + 2 = n + 1 := by omega rcases hj2 with h2 | h2 · rw [h2, Nat.mod_self] at hval; omega · rw [h2, h_n_add_one] at hval; omega have h12 : j1 ≠ j2 := by intro h have hval := congr_arg Fin.val h dsimp [j1, j2] at hval by_cases hj2 : j.val + 2 < n · have hj1 : j.val + 1 < n := by omega rw [Nat.mod_eq_of_lt hj1, Nat.mod_eq_of_lt hj2] at hval; omega · have hjcase : j.val + 2 = n ∨ j.val + 2 = n + 1 := by omega rcases hjcase with h2 | h2 · have hj1 : j.val + 1 < n := by omega rw [Nat.mod_eq_of_lt hj1, h2, Nat.mod_self] at hval; omega · have hj1 : j.val + 1 = n := by omega rw [hj1, Nat.mod_self, h2, h_n_add_one] at hval; omega change ({j0, j1, j2} : Finset (Fin n)).card = 3 rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton] · intro h; simp only [Finset.mem_singleton] at h; exact h12 h · simp only [Finset.mem_insert, Finset.mem_singleton]; rintro (h | h) · exact h01 h · exact h02 h unfold cyclic_cubic_syndrome split_ifs with h · rcases h with ⟨j, rfl⟩ have hc := h_triple_card j omega · rfllemma cyclic_cubic_parity_repr_ortho_card_le_two (n : ℕ) (hn : 6 ≤ n) (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (cyclic_cubic_syndrome n)) (A : Finset (Fin n)) (hA1 : 1 ≤ A.card) (hA2 : A.card ≤ 2) : ((S.filter (fun y => A ⊆ y)).card : ZMod 2) = 0 := by have hr := hS.2 A ⟨hA1, by omega⟩ rw [hr, cyclic_cubic_parity_repr_ortho_syndrome_card_le_two n hn A hA2]/-- Every parity representation S of cyclic_cubic_syndrome n satisfies ∑_{y ∈ S} (∑_{j ∈ y} c_j)(∑_{k ∈ y} d_k) = 0 and ∑_{y ∈ S} ∑_{j ∈ y} c_j = 0, because singletons and pairs have cyclic cubic syndrome 0. -/theorem cyclic_cubic_parity_repr_ortho (n : ℕ) (hn : 6 ≤ n) (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (cyclic_cubic_syndrome n)) (c d : Fin n → ZMod 2) : (∑ y ∈ S, (∑ j ∈ y, c j) * (∑ k ∈ y, d k) = 0) ∧ (∑ y ∈ S, (∑ j ∈ y, c j) = 0) := by constructor · have h1 : (∑ y ∈ S, (∑ j ∈ y, c j) * (∑ k ∈ y, d k)) = ∑ y ∈ S, ∑ j : Fin n, ∑ k : Fin n, (if j ∈ y then c j else 0) * (if k ∈ y then d k else 0) := by refine Finset.sum_congr rfl (fun y _ => ?_) rw [← Finset.sum_ite_mem_eq y c, ← Finset.sum_ite_mem_eq y d] rw [Finset.sum_mul_sum] rw [h1, Finset.sum_comm] refine Finset.sum_eq_zero (fun j _ => ?_) rw [Finset.sum_comm] refine Finset.sum_eq_zero (fun k _ => ?_) have h_split : (∑ y ∈ S, (if j ∈ y then c j else 0) * (if k ∈ y then d k else 0)) = (c j * d k) * ∑ y ∈ S, (if j ∈ y ∧ k ∈ y then (1 : ZMod 2) else 0) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun y _ => ?_) by_cases hj : j ∈ y <;> by_cases hk : k ∈ y <;> simp [hj, hk] rw [h_split, Finset.sum_boole] have h_filt : {x ∈ S | j ∈ x ∧ k ∈ x} = S.filter (fun y => {j, k} ⊆ y) := by ext y simp only [Finset.mem_filter, Finset.insert_subset_iff, Finset.singleton_subset_iff] rw [h_filt] have hne : ({j, k} : Finset (Fin n)).Nonempty := ⟨j, Finset.mem_insert_self j _⟩ have hcard1 : 1 ≤ ({j, k} : Finset (Fin n)).card := Finset.Nonempty.card_pos hne have hcard2 : ({j, k} : Finset (Fin n)).card ≤ 2 := by have := Finset.card_insert_le j {k} rw [Finset.card_singleton] at this omega have h_zero := cyclic_cubic_parity_repr_ortho_card_le_two n hn S hS {j, k} hcard1 hcard2 rw [h_zero, mul_zero] · have h1 : (∑ y ∈ S, ∑ j ∈ y, c j) = ∑ y ∈ S, ∑ j : Fin n, if j ∈ y then c j else 0 := by refine Finset.sum_congr rfl (fun y _ => ?_) exact (Finset.sum_ite_mem_eq y c).symm rw [h1, Finset.sum_comm] refine Finset.sum_eq_zero (fun j _ => ?_) have h_split : (∑ y ∈ S, if j ∈ y then c j else 0) = c j * ∑ y ∈ S, (if j ∈ y then (1 : ZMod 2) else 0) := by rw [Finset.mul_sum] refine Finset.sum_congr rfl (fun y _ => ?_) split_ifs <;> ring rw [h_split, Finset.sum_boole] have h_filt : {x ∈ S | j ∈ x} = S.filter (fun y => {j} ⊆ y) := by ext y simp only [Finset.mem_filter, Finset.singleton_subset_iff] rw [h_filt] have hcard1 : 1 ≤ ({j} : Finset (Fin n)).card := by rw [Finset.card_singleton] have hcard2 : ({j} : Finset (Fin n)).card ≤ 2 := by rw [Finset.card_singleton]; omega have h_zero := cyclic_cubic_parity_repr_ortho_card_le_two n hn S hS {j} hcard1 hcard2 rw [h_zero, mul_zero]