proof(E8Sidon): close sidon_energy_bound via RRC dimensional classification

Add finset_pair_eq_iff lemma (the 'dimensional annotation' step):
  {a,b} = {c,d} as Finsets → (a=c ∧ b=d) ∨ (a=d ∧ b=c)
Proved via Set.pair_eq_pair_iff + Finset.coe_inj coercion.

Use it to close sidon_energy_bound (E(S) ≤ 2k²):
  1. Route every filtered quadruple to 'same' or 'swap' shape
  2. Each shape is an image of S×S (card ≤ k²)
  3. Union ≤ same.card + swap.card ≤ 2k²

Inspired by Trail of Bits dimensional analysis technique:
annotate once (finset_pair_eq_iff), validate mechanically.

Sorry count: 9 tokens across 8 theorems (down from 10/9).

Build: 3210 jobs, 0 errors
Co-Authored-By: Allaun Silverfox <bigdataiscoming+9i37y6j2@protonmail.com>
This commit is contained in:
Devin AI 2026-06-15 22:23:23 +00:00
parent 15fb4bf30c
commit 10feb8d717

View file

@ -207,6 +207,19 @@ theorem E4_sq_eq_E8_coeff (n : ) (hn : 2 ≤ n) :
-- §5. Sidon Set Basics -- §5. Sidon Set Basics
-- ═══════════════════════════════════════════════════════════════════════════════ -- ═══════════════════════════════════════════════════════════════════════════════
/-- Dimensional annotation lemma (RRC-style classification):
Finset pair equality {a,b} = {c,d} classifies into exactly two shapes:
(a=c ∧ b=d) or (a=d ∧ b=c). This is the "vocabulary" for all Sidon
counting proofs — once this is established, cardinality bounds become
mechanical routing through the two shapes.
Uses Set.pair_eq_pair_iff via Finset.coe_pair coercion. -/
private lemma finset_pair_eq_iff {a b c d : }
(h : ({a, b} : Finset ) = {c, d}) :
(a = c ∧ b = d) (a = d ∧ b = c) := by
have hset : ({a, b} : Set ) = {c, d} := by
rw [← Finset.coe_pair, ← Finset.coe_pair, Finset.coe_inj.mpr h]
exact Set.pair_eq_pair_iff.mp hset
/-- A finite set S ⊆ is a Sidon set (B₂ set) if all pairwise sums a+b /-- A finite set S ⊆ is a Sidon set (B₂ set) if all pairwise sums a+b
(with a ≤ b, both in S) are distinct. Equivalently, the sumset S+S (with a ≤ b, both in S) are distinct. Equivalently, the sumset S+S
has no repeated representations. -/ has no repeated representations. -/
@ -238,16 +251,35 @@ def additiveEnergy (S : Finset ) : :=
((S ×ˢ S) ×ˢ (S ×ˢ S)).filter ((S ×ˢ S) ×ˢ (S ×ˢ S)).filter
(fun ((a, b), (c, d)) => a + b = c + d) |>.card (fun ((a, b), (c, d)) => a + b = c + d) |>.card
/-- Sidon sets have additive energy exactly 2|S|² - |S|. -/ /-- Sidon sets have additive energy at most 2|S|².
Proof by RRC-style dimensional classification: finset_pair_eq_iff
routes every quadruple to shape "same" or "swap", each bounded by k². -/
theorem sidon_energy_bound (S : Finset ) (hS : IsSidonSet S) : theorem sidon_energy_bound (S : Finset ) (hS : IsSidonSet S) :
additiveEnergy S ≤ 2 * S.card ^ 2 := by additiveEnergy S ≤ 2 * S.card ^ 2 := by
-- TODO(lean-port): By Sidon, every (a,b,c,d) ∈ S⁴ with a+b=c+d has {a,b}={c,d}. unfold additiveEnergy
-- So (c,d) = (a,b) or (c,d) = (b,a). The filtered set ⊆ same_set swap_set, -- The "same" and "swap" target sets (images of S×S under diagonal/swap maps)
-- each of which injects into S×S via Prod.fst (uniquely determined by first pair). let same := (S ×ˢ S).image (fun p => (p, p))
-- Proof approach: from {a,b}={c,d} extract c∈{a,b} via hS_eq.symm ▸ mem_insert, let swap := (S ×ˢ S).image (fun p => (p, (p.2, p.1)))
-- then case split on c=a (same) or c=b (swap). Each half has card ≤ k². -- Every filtered quadruple routes to same swap via finset_pair_eq_iff
-- Total ≤ 2k². Blocked on Finset pair-membership simp and product projection API. have hsub : ((S ×ˢ S) ×ˢ (S ×ˢ S)).filter
sorry (fun x : ( × ) × ( × ) => x.1.1 + x.1.2 = x.2.1 + x.2.2) ⊆
same swap := by
intro ⟨⟨a, b⟩, ⟨c, d⟩⟩ hmem
simp only [Finset.mem_filter, Finset.mem_product] at hmem
obtain ⟨⟨⟨ha, hb⟩, hc, hd⟩, hsum⟩ := hmem
have hpair := hS a b c d ha hb hc hd hsum
have hab_mem : (a, b) ∈ S ×ˢ S := Finset.mem_product.mpr ⟨ha, hb⟩
rcases finset_pair_eq_iff hpair with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩
· exact Finset.mem_union_left _ (Finset.mem_image.mpr ⟨(a, b), hab_mem, rfl⟩)
· exact Finset.mem_union_right _ (Finset.mem_image.mpr ⟨(a, b), hab_mem, rfl⟩)
-- Mechanical cardinality bound: filtered ≤ same swap ≤ same + swap ≤ 2k²
have hcard : (same swap).card ≤ 2 * S.card ^ 2 :=
calc (same swap).card
≤ same.card + swap.card := Finset.card_union_le same swap
_ ≤ (S ×ˢ S).card + (S ×ˢ S).card :=
Nat.add_le_add Finset.card_image_le Finset.card_image_le
_ = 2 * S.card ^ 2 := by simp [Finset.card_product, Nat.pow_succ, Nat.mul_comm]; ring
exact le_trans (Finset.card_le_card hsub) hcard
-- ═══════════════════════════════════════════════════════════════════════════════ -- ═══════════════════════════════════════════════════════════════════════════════
-- §7. E₈ Lattice Level-Set Structure -- §7. E₈ Lattice Level-Set Structure
@ -666,25 +698,26 @@ theorem fiber_partition (S : Finset ) (s : ) :
|------|------|--------|--------| |------|------|--------|--------|
| `e8_additive_completeness` | §10 | axiom | Open problem in additive combinatorics | | `e8_additive_completeness` | §10 | axiom | Open problem in additive combinatorics |
### Fully proved theorems (§8 additions) ### Fully proved theorems (§5-§11)
| Item | Section | Notes | | Item | Section | Notes |
|------|---------|-------| |------|---------|-------|
| `finset_pair_eq_iff` | §5 | RRC classification: {a,b}={c,d} → sameswap via Set.pair_eq_pair_iff |
| `sidon_energy_bound` | §6 | Full proof: dimensional routing to sameswap, each ≤ k² |
| `sidon_diff_injective` | §8 | Core lemma: Sidon → distinct positive differences | | `sidon_diff_injective` | §8 | Core lemma: Sidon → distinct positive differences |
| `exists_collision_witness` | §8 | ¬Sidon → ∃ collision witness extractable | | `exists_collision_witness` | §8 | ¬Sidon → ∃ collision witness extractable |
| `greedy_sidon_sqrt` | §8 | Full proof: offDiag involution + injection into Icc 1 sup | | `greedy_sidon_sqrt` | §8 | Full proof: offDiag involution + injection into Icc 1 sup |
| `fiber_partition` | §11 | Full proof: swap involution splits fiber into even halves | | `fiber_partition` | §11 | Full proof: swap involution splits fiber into even halves |
| `e8_levelset_density` | §9 | Full proof: Finset.sup' gives finite C bound | | `e8_levelset_density` | §9 | Full proof: Finset.sup' gives finite C bound |
### Sorry inventory (10 sorry tokens across 9 theorems, all with TODO(lean-port)) ### Sorry inventory (9 sorry tokens across 8 theorems, all with TODO(lean-port))
| Item | Section | Blocked on | | Item | Section | Blocked on |
|------|---------|------------| |------|---------|------------|
| `E4_sq_eq_E8_coeff` | §4 | Mathlib: valence formula or dim M₈ = 1 | | `E4_sq_eq_E8_coeff` | §4 | Mathlib: valence formula or dim M₈ = 1 |
| `sidon_energy_bound` | §6 | Finset counting; provable now with effort |
| `r8_via_sigma3` | §7 | Same as E4_sq_eq_E8_coeff (Θ_{E₈} = E₄) | | `r8_via_sigma3` | §7 | Same as E4_sq_eq_E8_coeff (Θ_{E₈} = E₄) |
| `r8_one` | §7 | Definition mismatch; needs Θ_{E₈} = E₄ | | `r8_one` | §7 | Definition mismatch; needs Θ_{E₈} = E₄ |
| `sidon_iff_zero_collision` | §8 | Finset energy counting (2 sub-sorries) | | `sidon_iff_zero_collision` | §8 | Exact cardinality of same∩swap (2 sub-sorries) |
| `collision_excess_decrease` | §8 | Energy decrease bound (Finset filter counting) | | `collision_excess_decrease` | §8 | Energy decrease bound (Finset filter counting) |
| `greedy_sidon_extraction` | §8 | Well-founded induction + √ cardinality bound | | `greedy_sidon_extraction` | §8 | Well-founded induction + √ cardinality bound |
| `e8_singer_improvement` | §10 | Singer difference set construction | | `e8_singer_improvement` | §10 | Singer difference set construction |