[Formalized by test on 24 Nov 2026]
Title:Lemma balister_gyori_schelp_of_three · The Balister–Győri–Schelp conjecture
Source:Problems from arXiv papers
Proved lemma Checked by Lean. Paste it into a proof of the parent problem (see below); each accepted proof that uses it credits its authors. See the proof by test, 24 Nov 2026.
Statement:reviewed
Lemma for:The Balister–Győri–Schelp conjecture
Reuse this lemma — paste it into your Solution.lean, before the theorem that uses it
/-- Intermediate lemma (nosorry): Base case s = 3 of the Balister-Győri-Schelp conjecture: a zero-sum quadruple (a, b, c, d) of nonzero vectors in 𝔽₂ 3 either has all four equal (handled by balister_gyori_schelp_of_const), splits into two equal pairs (matched on cosets of ⟨a, c⟩), or has four distinct vectors so {a, b, c} is a basis of 𝔽₂ 3 with explicit matching {0,a}, {c,b+c}, {a+b,a+b+c}, {b,a+c}. -/
theorem balister_gyori_schelp_of_three (v : Fin (2 ^ (3 - 1)) → 𝔽₂ 3)
(hv_nonzero : ∀ i, v i ≠ 0) (hv_sum : ∑ i, v i = 0) :
∃ e : Fin (2 ^ (3 - 1)) × Fin 2 ≃ 𝔽₂ 3, ∀ i, e (i, 0) + e (i, 1) = v i := by
classical
have hsum4 : v 0 + v 1 + v 2 + v 3 = 0 := by
change ∑ i : Fin 4, v i = 0 at hv_sum
rw [Fin.sum_univ_four] at hv_sum
exact hv_sum
have hpair_eq : ∀ {x y z t : 𝔽₂ 3}, x + y + z + t = 0 → x = y → z = t := by
intro x y z t h hxy
subst hxy
rw [f2_add_self, zero_add] at h
exact f2_eq_of_add_eq_zero h
-- Helper to apply a permutation of Fin 4
have perm_apply : ∀ (σ : Fin 4 ≃ Fin 4) (e : Fin 4 × Fin 2 ≃ 𝔽₂ 3),
(∀ i, e (i, 0) + e (i, 1) = v (σ i)) →
∃ e' : Fin 4 × Fin 2 ≃ 𝔽₂ 3, ∀ i, e' (i, 0) + e' (i, 1) = v i := by
intro σ e he
refine ⟨(Equiv.prodCongr σ.symm (Equiv.refl (Fin 2))).trans e, fun i => ?_⟩
simp [he (σ.symm i)]
by_cases h01 : v 0 = v 1
· have h23 : v 2 = v 3 := hpair_eq hsum4 h01
by_cases h02 : v 0 = v 2
· obtain ⟨e, he⟩ := balister_gyori_schelp_of_const 3 (by omega) (v 0) (hv_nonzero 0)
refine ⟨e, fun i => ?_⟩
rw [he i]; fin_cases i
· rfl
· exact h01
· exact h02
· exact h02.trans h23
· obtain ⟨e, h0, h1, h2, h3⟩ := bgs3_two_pairs (v 0) (v 2) (hv_nonzero 0) (hv_nonzero 2) h02
refine ⟨e, fun i => ?_⟩
fin_cases i
· exact h0
· exact h1.trans h01
· exact h2
· exact h3.trans h23
· by_cases h02 : v 0 = v 2
· have h13 : v 1 = v 3 := by
have h' : v 0 + v 2 + v 1 + v 3 = 0 := by
rw [← hsum4]; abel
exact hpair_eq h' h02
obtain ⟨e, h0, h1, h2, h3⟩ := bgs3_two_pairs (v 0) (v 1) (hv_nonzero 0) (hv_nonzero 1) h01
apply perm_apply (Equiv.swap (1 : Fin 4) (2 : Fin 4)) e
intro i; fin_cases i
· rw [Equiv.swap_apply_of_ne_of_ne (by decide) (by decide)]; exact h0
· change e (1, 0) + e (1, 1) = v ((Equiv.swap 1 2) 1); rw [Equiv.swap_apply_left]; exact h1.trans h02
· change e (2, 0) + e (2, 1) = v ((Equiv.swap 1 2) 2); rw [Equiv.swap_apply_right]; exact h2
· rw [Equiv.swap_apply_of_ne_of_ne (by decide) (by decide)]; exact h3.trans h13
· by_cases h03 : v 0 = v 3
· have h12 : v 1 = v 2 := by
have h' : v 0 + v 3 + v 1 + v 2 = 0 := by
rw [← hsum4]; abel
exact hpair_eq h' h03
obtain ⟨e, h0, h1, h2, h3⟩ := bgs3_two_pairs (v 0) (v 1) (hv_nonzero 0) (hv_nonzero 1) h01
apply perm_apply (Equiv.swap (1 : Fin 4) (3 : Fin 4)) e
intro i; fin_cases i
· rw [Equiv.swap_apply_of_ne_of_ne (by decide) (by decide)]; exact h0
· change e (1, 0) + e (1, 1) = v ((Equiv.swap 1 3) 1); rw [Equiv.swap_apply_left]; exact h1.trans h03
· rw [Equiv.swap_apply_of_ne_of_ne (by decide) (by decide)]; exact h2.trans h12
· change e (3, 0) + e (3, 1) = v ((Equiv.swap 1 3) 3); rw [Equiv.swap_apply_right]; exact h3
· -- All four vectors v 0, v 1, v 2, v 3 are pairwise distinct, so {a, b, c} is a basis of 𝔽₂ 3!
set a := v 0
set b := v 1
set c := v 2
have hd_eq : v 3 = a + b + c := (f2_eq_of_add_eq_zero hsum4).symm
have ha : a ≠ 0 := hv_nonzero 0
have hb : b ≠ 0 := hv_nonzero 1
have hc : c ≠ 0 := hv_nonzero 2
have hd : a + b + c ≠ 0 := hd_eq ▸ hv_nonzero 3
have h12 : b ≠ c := by
intro hEq
have : a = v 3 := hpair_eq (by rw [← hsum4]; abel) hEq
exact h03 this
have hab0 : a + b ≠ 0 := fun h => h01 (f2_eq_of_add_eq_zero h)
have hac0 : a + c ≠ 0 := fun h => h02 (f2_eq_of_add_eq_zero h)
have hbc0 : b + c ≠ 0 := fun h => h12 (f2_eq_of_add_eq_zero h)
have hlin : ∀ (x y z : Bool),
(if x then a else 0) + (if y then b else 0) + (if z then c else 0) = 0 →
x = false ∧ y = false ∧ z = false := by
intro x y z hxyz
cases x <;> cases y <;> cases z
· exact ⟨rfl, rfl, rfl⟩
· simp only [Bool.false_eq_true, ↓reduceIte, zero_add] at hxyz; exact absurd hxyz hc
· simp only [Bool.false_eq_true, ↓reduceIte, zero_add, add_zero] at hxyz; exact absurd hxyz hb
· simp only [Bool.false_eq_true, ↓reduceIte, zero_add] at hxyz; exact absurd hxyz hbc0
· simp only [Bool.false_eq_true, ↓reduceIte, add_zero] at hxyz; exact absurd hxyz ha
· simp only [Bool.false_eq_true, ↓reduceIte, add_zero] at hxyz; exact absurd hxyz hac0
· simp only [Bool.false_eq_true, ↓reduceIte, add_zero] at hxyz; exact absurd hxyz hab0
· simp only [↓reduceIte] at hxyz; exact absurd hxyz hd
-- Explicit bijection: {0, a}, {c, b+c}, {a+b, a+b+c}, {b, a+c}
let coeff : Fin 4 × Fin 2 → Bool × Bool × Bool := fun p =>
match p with
| (0, 0) => (false, false, false)
| (0, 1) => (true, false, false)
| (1, 0) => (false, false, true)
| (1, 1) => (false, true, true)
| (2, 0) => (true, true, false)
| (2, 1) => (true, true, true)
| (3, 0) => (false, true, false)
| (3, 1) => (true, false, true)
let f : Fin 4 × Fin 2 → 𝔽₂ 3 := fun p =>
(if (coeff p).1 then a else 0) + (if (coeff p).2.1 then b else 0) + (if (coeff p).2.2 then c else 0)
have hcoeff_inj : Function.Injective coeff := by decide
have hbool_xor : ∀ (u t : Bool) (w : 𝔽₂ 3),
(if u then w else 0) + (if t then w else 0) = if (u != t) then w else 0 := by
intro u t w; cases u <;> cases t <;> simp [f2_add_self]
have hf_inj : Function.Injective f := by
intro p1 p2 hEq
have hsub : f p1 + f p2 = 0 := by rw [hEq, f2_add_self]
have hcomb : (if ((coeff p1).1 != (coeff p2).1) then a else 0) +
(if ((coeff p1).2.1 != (coeff p2).2.1) then b else 0) +
(if ((coeff p1).2.2 != (coeff p2).2.2) then c else 0) = f p1 + f p2 := by
rw [← hbool_xor, ← hbool_xor, ← hbool_xor]
dsimp only [f]; abel
rw [hsub] at hcomb
obtain ⟨h1, h2, h3⟩ := hlin _ _ _ hcomb
have hb_eq : ∀ u t : Bool, (u != t) = false → u = t := by decide
apply hcoeff_inj
exact Prod.ext (hb_eq _ _ h1) (Prod.ext (hb_eq _ _ h2) (hb_eq _ _ h3))
have hf_bij : Function.Bijective f :=
(Fintype.bijective_iff_injective_and_card f).mpr ⟨hf_inj, by rw [Fintype.card_prod, Fintype.card_fin, Fintype.card_fin, f2_card_3]⟩
refine ⟨Equiv.ofBijective f hf_bij, fun i => ?_⟩
fin_cases i
· change (0 + 0 + 0) + (a + 0 + 0) = a; abel
· change (0 + 0 + c) + (0 + b + c) = b
have : (0 + 0 + c) + (0 + b + c) = (c + c) + b := by abel
rw [this, f2_add_self, zero_add]
· change (a + b + 0) + (a + b + c) = c
have : (a + b + 0) + (a + b + c) = (a + a) + (b + b) + c := by abel
rw [this, f2_add_self, f2_add_self, zero_add, zero_add]
· change (0 + b + 0) + (a + 0 + c) = v 3
rw [hd_eq]; abelFrom the first verified proof, s-w17r3ry9w4 (lemma proofs are public). If it relies on helper lemmas, copy them too.
Problem: Base case s = 3 of the Balister-Győri-Schelp conjecture: a zero-sum quadruple (a, b, c, d) of nonzero vectors in 𝔽₂ 3 either has all four equal (handled by balister_gyori_schelp_of_const), splits into two equal pairs (matched on cosets of ⟨a, c⟩), or has four distinct vectors so {a, b, … Full statement & Lean theorem →
- verifiedVerified proof by test2 d