AFTD Auto-Formalizing Theoretical Domains

line_cubic_parity_repr_eval_zero

theoremverified

For n ≥ 5, any affine evaluation (∑_{j ∈ y} c_j = b) on all parities y ∈ S of a parity representation S of line_syndrome n forces c = 0.

Statement

theorem line_cubic_parity_repr_eval_zero (n : ℕ) (hn : 5 ≤ n)
    (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (line_syndrome n))
    (c : Fin n → ZMod 2) (b : ZMod 2)
    (h : ∀ y ∈ S, (∑ j ∈ y, c j) = b) :
    c = 0
Source
step towards line_cubic_t_count_lower_bound
Verified
06 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…
  • line_syndromeThe syndrome of the line cubic form assigns 1 to adjacent triples {i, i+1, i+2} and 0 to all other subsets of Fin n.
Used by 1

The proof, explained

To prove that any affine evaluation ∑_{j ∈ y} c_j = b on parities y ∈ S of the line cubic syndrome forces c = 0, the argument double counts parities containing a chosen pair {p, q} to establish the orthogonality identity ∑_j c_j • line_syndrome n {j, p, q} = 0 for all p ≠ q. Choosing pairs separated by distance 2 (p = i, q = i + 2) isolates each internal coordinate, showing c_{i+1} = 0 for all 0 ≤ i ≤ n - 3. Finally, choosing the adjacent pairs {1, 2} and {n - 3, n - 2} connects the boundary coordinates c_0 and c_{n-1} to already vanished internal coordinates (c_3 and c_{n-4}), forcing the boundary coordinates to be zero as well.

  1. For any non-empty set of vertices A with |A| ≤ 2, the number of parities in S containing A is 0 modulo 2.

    By definition of a parity representation, the count modulo 2 of parities containing A equals line_syndrome n A. The line syndrome is 1 only for consecutive triples of cardinality 3; since |A| ≤ 2, A cannot be such a triple, so the syndrome evaluates to 0.

    lines 7–26

    uses Finset.card_insert_of_notMem, Finset.card_singleton, Finset.mem_singleton, Finset.mem_insert

      have hrepr := hS.2 A ⟨hA1, by omega⟩
      rw [hrepr]
      unfold line_syndrome
      split_ifs with h
      · rcases h with ⟨i, hi⟩
        have hc : ({⟨i.1, by omega⟩, ⟨i.1 + 1, by omega⟩, ⟨i.1 + 2, by omega⟩} : Finset (Fin n)).card = 3 := by
          have h01 : (⟨i.1, by omega⟩ : Fin n) ≠ ⟨i.1 + 1, by omega⟩ := by
            intro heq; injection heq with heq; omega
          have h02 : (⟨i.1, by omega⟩ : Fin n) ≠ ⟨i.1 + 2, by omega⟩ := by
            intro heq; injection heq with heq; omega
          have h12 : (⟨i.1 + 1, by omega⟩ : Fin n) ≠ ⟨i.1 + 2, by omega⟩ := by
            intro heq; injection heq with heq; omega
          rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton]
          · intro hm; simp only [Finset.mem_singleton] at hm; exact h12 hm
          · simp only [Finset.mem_insert, Finset.mem_singleton]; rintro (hm | hm)
            · exact h01 hm
            · exact h02 hm
        rw [hi] at hA2
        omega
      · rfl
  2. Membership in the consecutive triple starting at i corresponds to index i, i+1, or i+2.

    Unfolding the definition of the consecutive triple line_cubic_parity_repr_eval_zero_line_triple, an index a belongs to the triple if and only if a = i, a = i + 1, or a = i + 2.

    lines 28–34

    uses Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff

    def line_cubic_parity_repr_eval_zero_line_triple (n : ℕ) (i : Fin (n - 2)) : Finset (Fin n) :=
      {⟨i.1, by omega⟩, ⟨i.1 + 1, by omega⟩, ⟨i.1 + 2, by omega⟩}
    
    theorem line_cubic_parity_repr_eval_zero_mem_line_triple (n : ℕ) (i : Fin (n - 2)) (a : Fin n) :
        a ∈ line_cubic_parity_repr_eval_zero_line_triple n i ↔ a.1 = i.1 ∨ a.1 = i.1 + 1 ∨ a.1 = i.1 + 2 := by
      unfold line_cubic_parity_repr_eval_zero_line_triple
      simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]
  3. For any distinct pair p ≠ q, the sum of affine evaluations over all parities containing {p, q} is 0.

    Since each parity y ∈ S evaluates to the constant b, summing over all parities containing {p, q} yields |{y ∈ S | {p, q} ⊆ y}| • b. Because |{p, q}| = 2, this parity count is 0 modulo 2 by the small-cardinality lemma, so the product is 0.

    lines 42–55

    uses mem_filter, sum_const, nsmul_eq_mul, card_insert_of_notMem, Finset.card_singleton, line_cubic_parity_repr_eval_zero_card_le_two, zero_mul

      have h_zero : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) = 0 := by
        have h1 : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) =
            ∑ y ∈ S.filter (fun y => {p, q} ⊆ y), b := by
          refine sum_congr rfl (fun y hy => ?_)
          rw [mem_filter] at hy
          exact h y hy.1
        rw [h1, sum_const, nsmul_eq_mul]
        have hcard1 : 1 ≤ ({p, q} : Finset (Fin n)).card := by
          rw [card_insert_of_notMem (by simpa using hpq), Finset.card_singleton]
          omega
        have hcard2 : ({p, q} : Finset (Fin n)).card ≤ 2 := by
          rw [card_insert_of_notMem (by simpa using hpq), Finset.card_singleton]
        have hz := line_cubic_parity_repr_eval_zero_card_le_two n S hS {p, q} hcard1 hcard2
        rw [hz, zero_mul]
  4. For any distinct pair p ≠ q, the pair-sum identity ∑_j c_j • line_syndrome n {j, p, q} = 0 holds.

    Writing the sum over y of ∑_{j ∈ y} c_j and exchanging the order of summation yields ∑_j c_j • |{y ∈ S | {j, p, q} ⊆ y}|. By the parity representation property, this parity count modulo 2 is line_syndrome n {j, p, q}, which equates the sum to the previously established 0.

    lines 56–85

    uses sum_ite_mem_eq, sum_comm, mul_sum, sum_boole, mem_filter, Finset.insert_subset_iff, mem_insert_self, Nonempty.card_pos, card_insert_le, card_insert_of_notMem, Finset.card_singleton

      have h_swap : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) =
          ∑ j : Fin n, c j * line_syndrome n (insert j {p, q}) := by
        have h1 : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) =
            ∑ y ∈ S.filter (fun y => {p, q} ⊆ y), ∑ j : Fin n, (if j ∈ y then c j else 0) := by
          refine sum_congr rfl (fun y _ => (sum_ite_mem_eq y c).symm)
        rw [h1, sum_comm]
        refine sum_congr rfl (fun j _ => ?_)
        have h2 : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (if j ∈ y then c j else 0)) =
            c j * ∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (if j ∈ y then (1 : ZMod 2) else 0) := by
          rw [mul_sum]
          refine sum_congr rfl (fun y _ => by split_ifs <;> ring)
        rw [h2, sum_boole]
        have h3 : (S.filter (fun y => {p, q} ⊆ y)).filter (fun y => j ∈ y) =
            S.filter (fun y => insert j {p, q} ⊆ y) := by
          ext y
          simp only [mem_filter, Finset.insert_subset_iff]
          tauto
        rw [h3]
        have hcard1 : 1 ≤ (insert j ({p, q} : Finset (Fin n))).card := by
          have : (insert j ({p, q} : Finset (Fin n))).Nonempty := ⟨j, mem_insert_self _ _⟩
          exact Nonempty.card_pos this
        have hcard2 : (insert j ({p, q} : Finset (Fin n))).card ≤ 3 := by
          have h_sub := card_insert_le j ({p, q} : Finset (Fin n))
          have h_pq : ({p, q} : Finset (Fin n)).card = 2 := by
            rw [card_insert_of_notMem (by simpa using hpq), Finset.card_singleton]
          omega
        have h_repr := hS.2 (insert j {p, q}) ⟨hcard1, hcard2⟩
        rw [h_repr]
      rw [← h_swap]
      exact h_zero
  5. Evaluating c against the indicator of two distinct points a ≠ b gives c a + c b.

    Decomposing the two-point indicator into a sum of two single-point indicators and distributing the summation over all j isolates c a + c b.

    lines 89–104

    uses sum_add_distrib, sum_ite_eq'

      have h : ∀ j : Fin n, c j * (if j = a ∨ j = b then (1 : ZMod 2) else 0) =
          (if j = a then c a else 0) + (if j = b then c b else 0) := by
        intro j
        by_cases hja : j = a
        · rw [if_pos (Or.inl hja), if_pos hja]
          have hjb : j ≠ b := by rw [hja]; exact hab
          rw [if_neg hjb, hja]
          ring
        · by_cases hjb : j = b
          · rw [if_pos (Or.inr hjb), if_neg hja, if_pos hjb, hjb]
            ring
          · have hnab : ¬ (j = a ∨ j = b) := by tauto
            rw [if_neg hnab, if_neg hja, if_neg hjb]
            ring
      simp_rw [h, sum_add_distrib, sum_ite_eq']
      simp
  6. Every internal coordinate c_{i+1} is 0 for 0 ≤ i ≤ n - 3.

    Apply the pair-sum identity to p = i and q = i + 2. The only index j such that {j, i, i + 2} is a consecutive triple is j = i + 1, so the syndrome indicator collapses the sum to c_{i+1} = 0.

    lines 111–177

    uses line_cubic_parity_repr_eval_zero_mem_line_triple, line_cubic_parity_repr_eval_zero_pair_sum, sum_ite_eq'

        c ⟨i.1 + 1, by omega⟩ = 0 := by
      let p : Fin n := ⟨i.1, by omega⟩
      let q : Fin n := ⟨i.1 + 2, by omega⟩
      have hpq : p ≠ q := by
        intro heq
        have : p.1 = q.1 := congrArg Fin.val heq
        change i.1 = i.1 + 2 at this
        omega
      have h_syn : ∀ j : Fin n, line_syndrome n (insert j {p, q}) =
          if j = ⟨i.1 + 1, by omega⟩ then 1 else 0 := by
        intro j
        unfold line_syndrome
        by_cases hj : j = ⟨i.1 + 1, by omega⟩
        · rw [if_pos hj]
          have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
            refine ⟨i, ?_⟩
            ext x
            simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]
            rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
            dsimp [p, q]
            subst hj
            change x.1 = i.1 + 1 ∨ x.1 = i.1 ∨ x.1 = i.1 + 2 ↔ x.1 = i.1 ∨ x.1 = i.1 + 1 ∨ x.1 = i.1 + 2
            tauto
          exact if_pos hex
        · rw [if_neg hj]
          have h_not : ¬ ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
            rintro ⟨k, hk⟩
            have hp_in : p ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
              rw [← hk]
              simp
            have hq_in : q ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
              rw [← hk]
              simp
            rw [line_cubic_parity_repr_eval_zero_mem_line_triple] at hp_in hq_in
            dsimp [p, q] at hp_in hq_in
            have hki : k.1 = i.1 := by omega
            have h_mid : (⟨i.1 + 1, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
              dsimp
              omega
            change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
            rw [← hk] at h_mid
            simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h_mid
            dsimp [p, q] at h_mid
            change i.1 + 1 = j.1 ∨ i.1 + 1 = i.1 ∨ i.1 + 1 = i.1 + 2 at h_mid
            have : j = ⟨i.1 + 1, by omega⟩ := by
              ext
              change j.1 = i.1 + 1
              omega
            exact hj this
          exact if_neg h_not
      have h_pair := line_cubic_parity_repr_eval_zero_pair_sum n S hS c b h p q hpq
      have h_eval : (∑ j : Fin n, c j * line_syndrome n (insert j {p, q})) = c ⟨i.1 + 1, by omega⟩ := by
        have h_term : ∀ j : Fin n, c j * line_syndrome n (insert j {p, q}) =
            if j = ⟨i.1 + 1, by omega⟩ then c ⟨i.1 + 1, by omega⟩ else 0 := by
          intro j
          rw [h_syn]
          split_ifs with hj
          · subst hj; ring
          · ring
        simp_rw [h_term]
        rw [sum_ite_eq']
        simp
      rw [h_eval] at h_pair
      exact h_pair
  7. The first coordinate c 0 is 0.

    Apply the pair-sum identity to the adjacent pair p = 1 and q = 2. The only indices completing {1, 2} to a consecutive triple are j = 0 and j = 3, yielding c 0 + c 3 = 0. Since n ≥ 5, index 3 is an internal coordinate (3 = 2 + 1 ≤ n - 2), so c 3 = 0, which forces c 0 = 0.

    lines 183–270

    uses line_cubic_parity_repr_eval_zero_pair_sum, line_cubic_parity_repr_eval_zero_mem_line_triple, line_cubic_parity_repr_eval_zero_two_points, line_cubic_parity_repr_eval_zero_mid, add_zero

        c ⟨0, by omega⟩ = 0 := by
      let p : Fin n := ⟨1, by omega⟩
      let q : Fin n := ⟨2, by omega⟩
      have hpq : p ≠ q := by
        intro heq
        have : p.1 = q.1 := congrArg Fin.val heq
        change 1 = 2 at this
        omega
      have h_pair := line_cubic_parity_repr_eval_zero_pair_sum n S hS c b h p q hpq
      have h_syn : ∀ j : Fin n, line_syndrome n (insert j {p, q}) =
          if j = ⟨0, by omega⟩ ∨ j = ⟨3, by omega⟩ then 1 else 0 := by
        intro j
        unfold line_syndrome
        by_cases hj : j = ⟨0, by omega⟩ ∨ j = ⟨3, by omega⟩
        · rw [if_pos hj]
          rcases hj with hj0 | hj3
          · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
              refine ⟨⟨0, by omega⟩, ?_⟩
              ext x
              simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]
              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
              dsimp [p, q]
              subst hj0
              change x.1 = 0 ∨ x.1 = 1 ∨ x.1 = 2 ↔ x.1 = 0 ∨ x.1 = 0 + 1 ∨ x.1 = 0 + 2
              tauto
            exact if_pos hex
          · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
              refine ⟨⟨1, by omega⟩, ?_⟩
              ext x
              simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]
              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
              dsimp [p, q]
              subst hj3
              change x.1 = 3 ∨ x.1 = 1 ∨ x.1 = 2 ↔ x.1 = 1 ∨ x.1 = 1 + 1 ∨ x.1 = 1 + 2
              tauto
            exact if_pos hex
        · rw [if_neg hj]
          have h_not : ¬ ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
            rintro ⟨k, hk⟩
            have hp_in : p ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
              rw [← hk]
              simp
            have hq_in : q ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
              rw [← hk]
              simp
            rw [line_cubic_parity_repr_eval_zero_mem_line_triple] at hp_in hq_in
            dsimp [p, q] at hp_in hq_in
            change 1 = k.1 ∨ 1 = k.1 + 1 ∨ 1 = k.1 + 2 at hp_in
            change 2 = k.1 ∨ 2 = k.1 + 1 ∨ 2 = k.1 + 2 at hq_in
            have hk_cases : k.1 = 0 ∨ k.1 = 1 := by omega
            rcases hk_cases with hk0 | hk1
            · have hj0 : j = ⟨0, by omega⟩ := by
                have h0 : (⟨0, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
                  rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
                  dsimp
                  omega
                change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
                rw [← hk] at h0
                simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h0
                dsimp [p, q] at h0
                ext; change j.1 = 0; omega
              exact hj (Or.inl hj0)
            · have hj3 : j = ⟨3, by omega⟩ := by
                have h3 : (⟨3, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
                  rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
                  dsimp
                  omega
                change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
                rw [← hk] at h3
                simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h3
                dsimp [p, q] at h3
                ext; change j.1 = 3; omega
              exact hj (Or.inr hj3)
          exact if_neg h_not
      simp_rw [h_syn] at h_pair
      have h_eval := line_cubic_parity_repr_eval_zero_two_points n c ⟨0, by omega⟩ ⟨3, by omega⟩ (by
        intro heq
        have : (⟨0, by omega⟩ : Fin n).1 = (⟨3, by omega⟩ : Fin n).1 := congrArg Fin.val heq
        change 0 = 3 at this
        omega)
      rw [h_eval] at h_pair
      have h3 : c ⟨3, by omega⟩ = 0 := by
        have := line_cubic_parity_repr_eval_zero_mid n S hS c b h ⟨2, by omega⟩
        exact this
      rw [h3, add_zero] at h_pair
      exact h_pair
  8. The last coordinate c_{n-1} is 0.

    Apply the pair-sum identity to p = n - 3 and q = n - 2. The only indices completing this pair to a consecutive triple are j = n - 4 and j = n - 1, yielding c_{n-4} + c_{n-1} = 0. Since n ≥ 5, n - 4 is an internal coordinate ((n - 5) + 1), so c_{n-4} = 0, forcing c_{n-1} = 0.

    lines 276–373

    uses line_cubic_parity_repr_eval_zero_pair_sum, line_cubic_parity_repr_eval_zero_mem_line_triple, line_cubic_parity_repr_eval_zero_two_points, line_cubic_parity_repr_eval_zero_mid, zero_add

        c ⟨n - 1, by omega⟩ = 0 := by
      let p : Fin n := ⟨n - 3, by omega⟩
      let q : Fin n := ⟨n - 2, by omega⟩
      have hpq : p ≠ q := by
        intro heq
        have : p.1 = q.1 := congrArg Fin.val heq
        change n - 3 = n - 2 at this
        omega
      have h_pair := line_cubic_parity_repr_eval_zero_pair_sum n S hS c b h p q hpq
      have h_syn : ∀ j : Fin n, line_syndrome n (insert j {p, q}) =
          if j = ⟨n - 4, by omega⟩ ∨ j = ⟨n - 1, by omega⟩ then 1 else 0 := by
        intro j
        unfold line_syndrome
        by_cases hj : j = ⟨n - 4, by omega⟩ ∨ j = ⟨n - 1, by omega⟩
        · rw [if_pos hj]
          rcases hj with hj4 | hj1
          · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
              refine ⟨⟨n - 4, by omega⟩, ?_⟩
              ext x
              simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]
              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
              dsimp [p, q]
              subst hj4
              change x.1 = n - 4 ∨ x.1 = n - 3 ∨ x.1 = n - 2 ↔ x.1 = n - 4 ∨ x.1 = (n - 4) + 1 ∨ x.1 = (n - 4) + 2
              have h1 : (n - 4) + 1 = n - 3 := by omega
              have h2 : (n - 4) + 2 = n - 2 := by omega
              rw [h1, h2]
            exact if_pos hex
          · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
              refine ⟨⟨n - 3, by omega⟩, ?_⟩
              ext x
              simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]
              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
              dsimp [p, q]
              subst hj1
              change x.1 = n - 1 ∨ x.1 = n - 3 ∨ x.1 = n - 2 ↔ x.1 = n - 3 ∨ x.1 = (n - 3) + 1 ∨ x.1 = (n - 3) + 2
              have h1 : (n - 3) + 1 = n - 2 := by omega
              have h2 : (n - 3) + 2 = n - 1 := by omega
              rw [h1, h2]
              tauto
            exact if_pos hex
        · rw [if_neg hj]
          have h_not : ¬ ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by
            rintro ⟨k, hk⟩
            have hp_in : p ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
              rw [← hk]
              simp
            have hq_in : q ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
              change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
              rw [← hk]
              simp
            rw [line_cubic_parity_repr_eval_zero_mem_line_triple] at hp_in hq_in
            dsimp [p, q] at hp_in hq_in
            change n - 3 = k.1 ∨ n - 3 = k.1 + 1 ∨ n - 3 = k.1 + 2 at hp_in
            change n - 2 = k.1 ∨ n - 2 = k.1 + 1 ∨ n - 2 = k.1 + 2 at hq_in
            have hk_cases : k.1 = n - 4 ∨ k.1 = n - 3 := by
              have : k.1 < n - 2 := k.isLt
              omega
            rcases hk_cases with hk4 | hk3
            · have hj4 : j = ⟨n - 4, by omega⟩ := by
                have h0 : (⟨n - 4, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
                  rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
                  dsimp
                  omega
                change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
                rw [← hk] at h0
                simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h0
                dsimp [p, q] at h0
                ext; change j.1 = n - 4; omega
              exact hj (Or.inl hj4)
            · have hj1 : j = ⟨n - 1, by omega⟩ := by
                have h0 : (⟨n - 1, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by
                  rw [line_cubic_parity_repr_eval_zero_mem_line_triple]
                  dsimp
                  omega
                change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk
                rw [← hk] at h0
                simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h0
                dsimp [p, q] at h0
                ext; change j.1 = n - 1; omega
              exact hj (Or.inr hj1)
          exact if_neg h_not
      simp_rw [h_syn] at h_pair
      have h_eval := line_cubic_parity_repr_eval_zero_two_points n c ⟨n - 4, by omega⟩ ⟨n - 1, by omega⟩ (by
        intro heq
        have : (⟨n - 4, by omega⟩ : Fin n).1 = (⟨n - 1, by omega⟩ : Fin n).1 := congrArg Fin.val heq
        change n - 4 = n - 1 at this
        omega)
      rw [h_eval] at h_pair
      have h4 : c ⟨n - 4, by omega⟩ = 0 := by
        have := line_cubic_parity_repr_eval_zero_mid n S hS c b h ⟨n - 5, by omega⟩
        have heq : (⟨(⟨n - 5, by omega⟩ : Fin (n - 2)).1 + 1, by omega⟩ : Fin n) = ⟨n - 4, by omega⟩ := by
          ext; change (n - 5) + 1 = n - 4; omega
        rw [← heq]
        exact this
      rw [h4, zero_add] at h_pair
      exact h_pair
  9. The vector c is identically 0.

    Any coordinate x satisfies x = 0, x = n - 1, or 1 ≤ x ≤ n - 2. The first two cases vanish by the boundary lemmas, and the remaining intermediate case vanishes by the internal coordinate lemma since x = (x - 1) + 1. Thus c = 0.

    lines 381–395

    uses line_cubic_parity_repr_eval_zero_zero, line_cubic_parity_repr_eval_zero_last, line_cubic_parity_repr_eval_zero_mid

      ext x
      have hx : x.1 = 0 ∨ x.1 = n - 1 ∨ (1 ≤ x.1 ∧ x.1 ≤ n - 2) := by
        have : x.1 < n := x.isLt
        omega
      rcases hx with h0 | hn1 | hmid
      · have heq : x = ⟨0, by omega⟩ := by ext; exact h0
        rw [heq]
        exact line_cubic_parity_repr_eval_zero_zero n hn S hS c b h
      · have heq : x = ⟨n - 1, by omega⟩ := by ext; exact hn1
        rw [heq]
        exact line_cubic_parity_repr_eval_zero_last n hn S hS c b h
      · have heq : x = ⟨(⟨x.1 - 1, by omega⟩ : Fin (n - 2)).1 + 1, by omega⟩ := by
          ext; change x.1 = (x.1 - 1) + 1; omega
        rw [heq]
        exact line_cubic_parity_repr_eval_zero_mid n S hS c b h ⟨x.1 - 1, by omega⟩
Finset.card_insert_of_notMem
Adding an element not in a finite set increases its cardinality by 1.
Finset.card_singleton
The cardinality of a singleton set is 1.
Finset.mem_singleton
An element belongs to a singleton set if and only if it equals the element in the singleton.
Finset.mem_insert
An element belongs to an inserted set if and only if it equals the inserted element or belongs to the base set.
Fin.ext_iff
Two Fin values are equal if and only if their underlying natural values are equal.
mem_filter
Membership in a filtered finite set is membership in the base set and satisfaction of the predicate.
sum_const
Summing a constant value over a finite set equals the set's cardinality multiplied by the constant.
nsmul_eq_mul
Multiplication by a natural number equals the canonical coercion multiplied by the value.
card_insert_of_notMem
Adding an element not in a finite set increases its cardinality by 1.
line_cubic_parity_repr_eval_zero_card_le_two
For any non-empty set A with at most 2 elements, the number of parities in S containing A is 0 modulo 2.
zero_mul
Multiplying zero by any element yields zero.
sum_ite_mem_eq
Summing an indicator-weighted function over all elements equals the sum of the function over the subset.
sum_comm
The order of two finite summations can be exchanged.
mul_sum
A scalar factor distributes over a finite sum.
sum_boole
Summing a boolean indicator over a finite set gives the cardinality of the subset satisfying the predicate.
Finset.insert_subset_iff
An inserted set is a subset if and only if the inserted element belongs to the target and the rest is a subset.
mem_insert_self
An element belongs to the set formed by inserting it.
Nonempty.card_pos
A non-empty finite set has strictly positive cardinality.
card_insert_le
Inserting an element into a finite set increases its cardinality by at most 1.
sum_add_distrib
The sum of a sum of functions over a finite set equals the sum of their individual sums.
sum_ite_eq'
Summing a single-point indicator over a finite set evaluates the function at that point.
line_cubic_parity_repr_eval_zero_mem_line_triple
An element belongs to the line triple starting at i if and only if its value is i, i+1, or i+2.
line_cubic_parity_repr_eval_zero_pair_sum
For any pair of distinct indices p and q, the sum of c_j times the line syndrome of {j, p, q} is zero.
line_cubic_parity_repr_eval_zero_two_points
The sum of c_j weighted by the indicator of {a, b} equals c_a + c_b for distinct a and b.
line_cubic_parity_repr_eval_zero_mid
Every internal coordinate c_{i+1} vanishes for 0 ≤ i ≤ n - 3.
add_zero
Adding zero to an element leaves it unchanged.
zero_add
Zero added to an element equals that element.
line_cubic_parity_repr_eval_zero_zero
The first coordinate c_0 is zero.
line_cubic_parity_repr_eval_zero_last
The last coordinate c_{n-1} is zero.

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

Lean’s trace was cut to the first 400 of 447 tactics.

open Finsettheorem line_cubic_parity_repr_eval_zero_card_le_two (n : ℕ) (S : Finset (Finset (Fin n)))    (hS : is_parity_repr S (line_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 hrepr := hS.2 A ⟨hA1, by omega⟩  rw [hrepr]  unfold line_syndrome  split_ifs with h  · rcases h with ⟨i, hi⟩    have hc : ({⟨i.1, by omega⟩, ⟨i.1 + 1, by omega⟩, ⟨i.1 + 2, by omega⟩} : Finset (Fin n)).card = 3 := by      have h01 : (⟨i.1, by omega⟩ : Fin n) ≠ ⟨i.1 + 1, by omega⟩ := by        intro heq; injection heq with heq; omega      have h02 : (⟨i.1, by omega⟩ : Fin n) ≠ ⟨i.1 + 2, by omega⟩ := by        intro heq; injection heq with heq; omega      have h12 : (⟨i.1 + 1, by omega⟩ : Fin n) ≠ ⟨i.1 + 2, by omega⟩ := by        intro heq; injection heq with heq; omega      rw [Finset.card_insert_of_notMem, Finset.card_insert_of_notMem, Finset.card_singleton]      · intro hm; simp only [Finset.mem_singleton] at hm; exact h12 hm      · simp only [Finset.mem_insert, Finset.mem_singleton]; rintro (hm | hm)        · exact h01 hm        · exact h02 hm    rw [hi] at hA2    omega  · rfldef line_cubic_parity_repr_eval_zero_line_triple (n : ℕ) (i : Fin (n - 2)) : Finset (Fin n) :=  {⟨i.1, by omega⟩, ⟨i.1 + 1, by omega⟩, ⟨i.1 + 2, by omega⟩}theorem line_cubic_parity_repr_eval_zero_mem_line_triple (n : ℕ) (i : Fin (n - 2)) (a : Fin n) :    a ∈ line_cubic_parity_repr_eval_zero_line_triple n i ↔ a.1 = i.1 ∨ a.1 = i.1 + 1 ∨ a.1 = i.1 + 2 := by  unfold line_cubic_parity_repr_eval_zero_line_triple  simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]theorem line_cubic_parity_repr_eval_zero_pair_sum (n : ℕ)    (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (line_syndrome n))    (c : Fin n → ZMod 2) (b : ZMod 2)    (h : ∀ y ∈ S, (∑ j ∈ y, c j) = b)    (p q : Fin n) (hpq : p ≠ q) :    ∑ j : Fin n, c j * line_syndrome n (insert j {p, q}) = 0 := by  have h_zero : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) = 0 := by    have h1 : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) =        ∑ y ∈ S.filter (fun y => {p, q} ⊆ y), b := by      refine sum_congr rfl (fun y hy => ?_)      rw [mem_filter] at hy      exact h y hy.1    rw [h1, sum_const, nsmul_eq_mul]    have hcard1 : 1 ≤ ({p, q} : Finset (Fin n)).card := by      rw [card_insert_of_notMem (by simpa using hpq), Finset.card_singleton]      omega    have hcard2 : ({p, q} : Finset (Fin n)).card ≤ 2 := by      rw [card_insert_of_notMem (by simpa using hpq), Finset.card_singleton]    have hz := line_cubic_parity_repr_eval_zero_card_le_two n S hS {p, q} hcard1 hcard2    rw [hz, zero_mul]  have h_swap : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) =      ∑ j : Fin n, c j * line_syndrome n (insert j {p, q}) := by    have h1 : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (∑ j ∈ y, c j)) =        ∑ y ∈ S.filter (fun y => {p, q} ⊆ y), ∑ j : Fin n, (if j ∈ y then c j else 0) := by      refine sum_congr rfl (fun y _ => (sum_ite_mem_eq y c).symm)    rw [h1, sum_comm]    refine sum_congr rfl (fun j _ => ?_)    have h2 : (∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (if j ∈ y then c j else 0)) =        c j * ∑ y ∈ S.filter (fun y => {p, q} ⊆ y), (if j ∈ y then (1 : ZMod 2) else 0) := by      rw [mul_sum]      refine sum_congr rfl (fun y _ => by split_ifs <;> ring)    rw [h2, sum_boole]    have h3 : (S.filter (fun y => {p, q} ⊆ y)).filter (fun y => j ∈ y) =        S.filter (fun y => insert j {p, q} ⊆ y) := by      ext y      simp only [mem_filter, Finset.insert_subset_iff]      tauto    rw [h3]    have hcard1 : 1 ≤ (insert j ({p, q} : Finset (Fin n))).card := by      have : (insert j ({p, q} : Finset (Fin n))).Nonempty := ⟨j, mem_insert_self _ _⟩      exact Nonempty.card_pos this    have hcard2 : (insert j ({p, q} : Finset (Fin n))).card ≤ 3 := by      have h_sub := card_insert_le j ({p, q} : Finset (Fin n))      have h_pq : ({p, q} : Finset (Fin n)).card = 2 := by        rw [card_insert_of_notMem (by simpa using hpq), Finset.card_singleton]      omega    have h_repr := hS.2 (insert j {p, q}) ⟨hcard1, hcard2⟩    rw [h_repr]  rw [← h_swap]  exact h_zerotheorem line_cubic_parity_repr_eval_zero_two_points (n : ℕ) (c : Fin n → ZMod 2) (a b : Fin n) (hab : a ≠ b) :    (∑ j : Fin n, c j * (if j = a ∨ j = b then 1 else 0)) = c a + c b := by  have h : ∀ j : Fin n, c j * (if j = a ∨ j = b then (1 : ZMod 2) else 0) =      (if j = a then c a else 0) + (if j = b then c b else 0) := by    intro j    by_cases hja : j = a    · rw [if_pos (Or.inl hja), if_pos hja]      have hjb : j ≠ b := by rw [hja]; exact hab      rw [if_neg hjb, hja]      ring    · by_cases hjb : j = b      · rw [if_pos (Or.inr hjb), if_neg hja, if_pos hjb, hjb]        ring      · have hnab : ¬ (j = a ∨ j = b) := by tauto        rw [if_neg hnab, if_neg hja, if_neg hjb]        ring  simp_rw [h, sum_add_distrib, sum_ite_eq']  simptheorem line_cubic_parity_repr_eval_zero_mid (n : ℕ)    (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (line_syndrome n))    (c : Fin n → ZMod 2) (b : ZMod 2)    (h : ∀ y ∈ S, (∑ j ∈ y, c j) = b)    (i : Fin (n - 2)) :    c ⟨i.1 + 1, by omega⟩ = 0 := by  let p : Fin n := ⟨i.1, by omega⟩  let q : Fin n := ⟨i.1 + 2, by omega⟩  have hpq : p ≠ q := by    intro heq    have : p.1 = q.1 := congrArg Fin.val heq    change i.1 = i.1 + 2 at this    omega  have h_syn : ∀ j : Fin n, line_syndrome n (insert j {p, q}) =      if j = ⟨i.1 + 1, by omega⟩ then 1 else 0 := by    intro j    unfold line_syndrome    by_cases hj : j = ⟨i.1 + 1, by omega⟩    · rw [if_pos hj]      have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by        refine ⟨i, ?_⟩        ext x        simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]        rw [line_cubic_parity_repr_eval_zero_mem_line_triple]        dsimp [p, q]        subst hj        change x.1 = i.1 + 1 ∨ x.1 = i.1 ∨ x.1 = i.1 + 2 ↔ x.1 = i.1 ∨ x.1 = i.1 + 1 ∨ x.1 = i.1 + 2        tauto      exact if_pos hex    · rw [if_neg hj]      have h_not : ¬ ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by        rintro ⟨k, hk⟩        have hp_in : p ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk          rw [← hk]          simp        have hq_in : q ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk          rw [← hk]          simp        rw [line_cubic_parity_repr_eval_zero_mem_line_triple] at hp_in hq_in        dsimp [p, q] at hp_in hq_in        have hki : k.1 = i.1 := by omega        have h_mid : (⟨i.1 + 1, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          rw [line_cubic_parity_repr_eval_zero_mem_line_triple]          dsimp          omega        change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk        rw [← hk] at h_mid        simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h_mid        dsimp [p, q] at h_mid        change i.1 + 1 = j.1 ∨ i.1 + 1 = i.1 ∨ i.1 + 1 = i.1 + 2 at h_mid        have : j = ⟨i.1 + 1, by omega⟩ := by          ext          change j.1 = i.1 + 1          omega        exact hj this      exact if_neg h_not  have h_pair := line_cubic_parity_repr_eval_zero_pair_sum n S hS c b h p q hpq  have h_eval : (∑ j : Fin n, c j * line_syndrome n (insert j {p, q})) = c ⟨i.1 + 1, by omega⟩ := by    have h_term : ∀ j : Fin n, c j * line_syndrome n (insert j {p, q}) =        if j = ⟨i.1 + 1, by omega⟩ then c ⟨i.1 + 1, by omega⟩ else 0 := by      intro j      rw [h_syn]      split_ifs with hj      · subst hj; ring      · ring    simp_rw [h_term]    rw [sum_ite_eq']    simp  rw [h_eval] at h_pair  exact h_pairtheorem line_cubic_parity_repr_eval_zero_zero (n : ℕ) (hn : 5 ≤ n)    (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (line_syndrome n))    (c : Fin n → ZMod 2) (b : ZMod 2)    (h : ∀ y ∈ S, (∑ j ∈ y, c j) = b) :    c ⟨0, by omega⟩ = 0 := by  let p : Fin n := ⟨1, by omega⟩  let q : Fin n := ⟨2, by omega⟩  have hpq : p ≠ q := by    intro heq    have : p.1 = q.1 := congrArg Fin.val heq    change 1 = 2 at this    omega  have h_pair := line_cubic_parity_repr_eval_zero_pair_sum n S hS c b h p q hpq  have h_syn : ∀ j : Fin n, line_syndrome n (insert j {p, q}) =      if j = ⟨0, by omega⟩ ∨ j = ⟨3, by omega⟩ then 1 else 0 := by    intro j    unfold line_syndrome    by_cases hj : j = ⟨0, by omega⟩ ∨ j = ⟨3, by omega⟩    · rw [if_pos hj]      rcases hj with hj0 | hj3      · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by          refine ⟨⟨0, by omega⟩, ?_⟩          ext x          simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]          rw [line_cubic_parity_repr_eval_zero_mem_line_triple]          dsimp [p, q]          subst hj0          change x.1 = 0 ∨ x.1 = 1 ∨ x.1 = 2 ↔ x.1 = 0 ∨ x.1 = 0 + 1 ∨ x.1 = 0 + 2          tauto        exact if_pos hex      · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by          refine ⟨⟨1, by omega⟩, ?_⟩          ext x          simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]          rw [line_cubic_parity_repr_eval_zero_mem_line_triple]          dsimp [p, q]          subst hj3          change x.1 = 3 ∨ x.1 = 1 ∨ x.1 = 2 ↔ x.1 = 1 ∨ x.1 = 1 + 1 ∨ x.1 = 1 + 2          tauto        exact if_pos hex    · rw [if_neg hj]      have h_not : ¬ ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by        rintro ⟨k, hk⟩        have hp_in : p ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk          rw [← hk]          simp        have hq_in : q ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk          rw [← hk]          simp        rw [line_cubic_parity_repr_eval_zero_mem_line_triple] at hp_in hq_in        dsimp [p, q] at hp_in hq_in        change 1 = k.1 ∨ 1 = k.1 + 1 ∨ 1 = k.1 + 2 at hp_in        change 2 = k.1 ∨ 2 = k.1 + 1 ∨ 2 = k.1 + 2 at hq_in        have hk_cases : k.1 = 0 ∨ k.1 = 1 := by omega        rcases hk_cases with hk0 | hk1        · have hj0 : j = ⟨0, by omega⟩ := by            have h0 : (⟨0, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]              dsimp              omega            change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk            rw [← hk] at h0            simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h0            dsimp [p, q] at h0            ext; change j.1 = 0; omega          exact hj (Or.inl hj0)        · have hj3 : j = ⟨3, by omega⟩ := by            have h3 : (⟨3, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]              dsimp              omega            change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk            rw [← hk] at h3            simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h3            dsimp [p, q] at h3            ext; change j.1 = 3; omega          exact hj (Or.inr hj3)      exact if_neg h_not  simp_rw [h_syn] at h_pair  have h_eval := line_cubic_parity_repr_eval_zero_two_points n c ⟨0, by omega⟩ ⟨3, by omega⟩ (by    intro heq    have : (⟨0, by omega⟩ : Fin n).1 = (⟨3, by omega⟩ : Fin n).1 := congrArg Fin.val heq    change 0 = 3 at this    omega)  rw [h_eval] at h_pair  have h3 : c ⟨3, by omega⟩ = 0 := by    have := line_cubic_parity_repr_eval_zero_mid n S hS c b h ⟨2, by omega⟩    exact this  rw [h3, add_zero] at h_pair  exact h_pairtheorem line_cubic_parity_repr_eval_zero_last (n : ℕ) (hn : 5 ≤ n)    (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (line_syndrome n))    (c : Fin n → ZMod 2) (b : ZMod 2)    (h : ∀ y ∈ S, (∑ j ∈ y, c j) = b) :    c ⟨n - 1, by omega⟩ = 0 := by  let p : Fin n := ⟨n - 3, by omega⟩  let q : Fin n := ⟨n - 2, by omega⟩  have hpq : p ≠ q := by    intro heq    have : p.1 = q.1 := congrArg Fin.val heq    change n - 3 = n - 2 at this    omega  have h_pair := line_cubic_parity_repr_eval_zero_pair_sum n S hS c b h p q hpq  have h_syn : ∀ j : Fin n, line_syndrome n (insert j {p, q}) =      if j = ⟨n - 4, by omega⟩ ∨ j = ⟨n - 1, by omega⟩ then 1 else 0 := by    intro j    unfold line_syndrome    by_cases hj : j = ⟨n - 4, by omega⟩ ∨ j = ⟨n - 1, by omega⟩    · rw [if_pos hj]      rcases hj with hj4 | hj1      · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by          refine ⟨⟨n - 4, by omega⟩, ?_⟩          ext x          simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]          rw [line_cubic_parity_repr_eval_zero_mem_line_triple]          dsimp [p, q]          subst hj4          change x.1 = n - 4 ∨ x.1 = n - 3 ∨ x.1 = n - 2 ↔ x.1 = n - 4 ∨ x.1 = (n - 4) + 1 ∨ x.1 = (n - 4) + 2          have h1 : (n - 4) + 1 = n - 3 := by omega          have h2 : (n - 4) + 2 = n - 2 := by omega          rw [h1, h2]        exact if_pos hex      · have hex : ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by          refine ⟨⟨n - 3, by omega⟩, ?_⟩          ext x          simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff]          rw [line_cubic_parity_repr_eval_zero_mem_line_triple]          dsimp [p, q]          subst hj1          change x.1 = n - 1 ∨ x.1 = n - 3 ∨ x.1 = n - 2 ↔ x.1 = n - 3 ∨ x.1 = (n - 3) + 1 ∨ x.1 = (n - 3) + 2          have h1 : (n - 3) + 1 = n - 2 := by omega          have h2 : (n - 3) + 2 = n - 1 := by omega          rw [h1, h2]          tauto        exact if_pos hex    · rw [if_neg hj]      have h_not : ¬ ∃ k : Fin (n - 2), insert j {p, q} = line_cubic_parity_repr_eval_zero_line_triple n k := by        rintro ⟨k, hk⟩        have hp_in : p ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk          rw [← hk]          simp        have hq_in : q ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by          change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk          rw [← hk]          simp        rw [line_cubic_parity_repr_eval_zero_mem_line_triple] at hp_in hq_in        dsimp [p, q] at hp_in hq_in        change n - 3 = k.1 ∨ n - 3 = k.1 + 1 ∨ n - 3 = k.1 + 2 at hp_in        change n - 2 = k.1 ∨ n - 2 = k.1 + 1 ∨ n - 2 = k.1 + 2 at hq_in        have hk_cases : k.1 = n - 4 ∨ k.1 = n - 3 := by          have : k.1 < n - 2 := k.isLt          omega        rcases hk_cases with hk4 | hk3        · have hj4 : j = ⟨n - 4, by omega⟩ := by            have h0 : (⟨n - 4, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]              dsimp              omega            change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk            rw [← hk] at h0            simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h0            dsimp [p, q] at h0            ext; change j.1 = n - 4; omega          exact hj (Or.inl hj4)        · have hj1 : j = ⟨n - 1, by omega⟩ := by            have h0 : (⟨n - 1, by omega⟩ : Fin n) ∈ line_cubic_parity_repr_eval_zero_line_triple n k := by              rw [line_cubic_parity_repr_eval_zero_mem_line_triple]              dsimp              omega            change {j, p, q} = line_cubic_parity_repr_eval_zero_line_triple n k at hk            rw [← hk] at h0            simp only [Finset.mem_insert, Finset.mem_singleton, Fin.ext_iff] at h0            dsimp [p, q] at h0            ext; change j.1 = n - 1; omega          exact hj (Or.inr hj1)      exact if_neg h_not  simp_rw [h_syn] at h_pair  have h_eval := line_cubic_parity_repr_eval_zero_two_points n c ⟨n - 4, by omega⟩ ⟨n - 1, by omega⟩ (by    intro heq    have : (⟨n - 4, by omega⟩ : Fin n).1 = (⟨n - 1, by omega⟩ : Fin n).1 := congrArg Fin.val heq    change n - 4 = n - 1 at this    omega)  rw [h_eval] at h_pair  have h4 : c ⟨n - 4, by omega⟩ = 0 := by    have := line_cubic_parity_repr_eval_zero_mid n S hS c b h ⟨n - 5, by omega⟩    have heq : (⟨(⟨n - 5, by omega⟩ : Fin (n - 2)).1 + 1, by omega⟩ : Fin n) = ⟨n - 4, by omega⟩ := by      ext; change (n - 5) + 1 = n - 4; omega    rw [← heq]    exact this  rw [h4, zero_add] at h_pair  exact h_pair/-- Any affine evaluation on all parities of a parity representation of the line cubic syndrome forces c = 0. -/theorem line_cubic_parity_repr_eval_zero (n : ℕ) (hn : 5 ≤ n)    (S : Finset (Finset (Fin n))) (hS : is_parity_repr S (line_syndrome n))    (c : Fin n → ZMod 2) (b : ZMod 2)    (h : ∀ y ∈ S, (∑ j ∈ y, c j) = b) :    c = 0 := by  ext x  have hx : x.1 = 0 ∨ x.1 = n - 1 ∨ (1 ≤ x.1 ∧ x.1 ≤ n - 2) := by    have : x.1 < n := x.isLt    omega  rcases hx with h0 | hn1 | hmid  · have heq : x = ⟨0, by omega⟩ := by ext; exact h0    rw [heq]    exact line_cubic_parity_repr_eval_zero_zero n hn S hS c b h  · have heq : x = ⟨n - 1, by omega⟩ := by ext; exact hn1    rw [heq]    exact line_cubic_parity_repr_eval_zero_last n hn S hS c b h  · have heq : x = ⟨(⟨x.1 - 1, by omega⟩ : Fin (n - 2)).1 + 1, by omega⟩ := by      ext; change x.1 = (x.1 - 1) + 1; omega    rw [heq]    exact line_cubic_parity_repr_eval_zero_mid n S hS c b h ⟨x.1 - 1, by omega⟩
See it in the graphDiscuss this resultChallenge it