| | @@ -0,0 +1,117 @@ |
| 1 | +import Mathlib.Algebra.Module.Presentation.Basic |
| 2 | +import Mathlib.LinearAlgebra.FiniteDimensional.Basic |
| 3 | +import Mathlib.SetTheory.Cardinal.Finite |
| 4 | + |
| 5 | +/-! |
| 6 | +# The modular relation space for Erdős problem 530 |
| 7 | + |
| 8 | +For a finite set `B`, `SymbolSpace F B` has a generator for each point and a relation for |
| 9 | +each true equality of pair sums, including repeated summands. For a prime `p`, taking `F = ZMod p` gives |
| 10 | +`V_p(B)` from §4 of `experiments/erdos530/lower-middle-energy/NOTES.md` and Proposition 7.2 |
| 11 | +of the October 2026 sidon-palomar report. The span is formed directly over `F`. |
| 12 | + |
| 13 | +Lean checks the construction, its universal property and the count `classCount F B` of distinct |
| 14 | +symbols. This count bounds the number of distinct labels of any sum-preserving map into an |
| 15 | +`F`-vector space. Applying inequality (8) with `h ≤ classCount F B` is a follow-up task. The |
| 16 | +asymptotic consequences of (8) are proved on paper. The implication from popular differences |
| 17 | +to a fixed gain in task t-6d127193c0 remains open. |
| 18 | +-/ |
| 19 | + |
| 20 | +namespace ErdosSwarm.Erdos530SymbolSpace |
| 21 | + |
| 22 | +open Finset |
| 23 | + |
| 24 | +variable {α : Type*} [AddCommMonoid α] |
| 25 | + |
| 26 | +/-- A true equality of pair sums among the points of `B`. -/ |
| 27 | +structure SumRelation (B : Finset α) where |
| 28 | + a : B |
| 29 | + b : B |
| 30 | + c : B |
| 31 | + d : B |
| 32 | + equal_sum : (a : α) + b = (c : α) + d |
| 33 | + |
| 34 | +/-- The presentation with one symbol per point and one linear equation per equal pair sum. -/ |
| 35 | +noncomputable def sumRelations (F : Type*) [Field F] (B : Finset α) : Module.Relations F where |
| 36 | + G := B |
| 37 | + R := SumRelation B |
| 38 | + relation r := (Finsupp.single r.a 1 + Finsupp.single r.b 1) - |
| 39 | + (Finsupp.single r.c 1 + Finsupp.single r.d 1) |
| 40 | + |
| 41 | +/-- The free vector space on `B` modulo the span of its pair-sum relations. -/ |
| 42 | +abbrev SymbolSpace (F : Type*) [Field F] (B : Finset α) := (sumRelations F B).Quotient |
| 43 | + |
| 44 | +variable (F : Type*) [Field F] (B : Finset α) |
| 45 | + |
| 46 | +instance : FiniteDimensional F (SymbolSpace F B) := by |
| 47 | + have : Finite (sumRelations F B).G := inferInstanceAs (Finite B) |
| 48 | + exact Module.Finite.of_surjective (sumRelations F B).toQuotient |
| 49 | + (sumRelations F B).surjective_toQuotient |
| 50 | + |
| 51 | +/-- The image of the basis vector for `b` in the quotient. -/ |
| 52 | +noncomputable def symbol (b : B) : SymbolSpace F B := |
| 53 | + (sumRelations F B).toQuotient (Finsupp.single b 1) |
| 54 | + |
| 55 | +/-- A labelling of the points respects every equal pair sum in the source. -/ |
| 56 | +def PreservesSums {V : Type*} [Add V] (f : B → V) : Prop := |
| 57 | + ∀ a b c d : B, (a : α) + b = (c : α) + d → f a + f b = f c + f d |
| 58 | + |
| 59 | +theorem symbol_preservesSums : PreservesSums B (symbol F B) := by |
| 60 | + intro a b c d h |
| 61 | + apply sub_eq_zero.mp |
| 62 | + simp only [symbol, ← map_add, ← map_sub] |
| 63 | + exact (sumRelations F B).toQuotient_relation (⟨a, b, c, d, h⟩ : SumRelation B) |
| 64 | + |
| 65 | +variable {V : Type*} [AddCommGroup V] [Module F V] |
| 66 | + |
| 67 | +/-- Every sum-preserving labelling extends uniquely to a linear map from the quotient. -/ |
| 68 | +theorem existsUnique_lift (f : B → V) (hf : PreservesSums B f) : |
| 69 | + ∃! L : SymbolSpace F B →ₗ[F] V, ∀ b : B, L (symbol F B b) = f b := by |
| 70 | + let s : (sumRelations F B).Solution V := |
| 71 | + { var := f |
| 72 | + linearCombination_var_relation := fun r => by |
| 73 | + change Finsupp.linearCombination F f |
| 74 | + ((Finsupp.single r.a 1 + Finsupp.single r.b 1) - |
| 75 | + (Finsupp.single r.c 1 + Finsupp.single r.d 1)) = 0 |
| 76 | + simp [hf r.a r.b r.c r.d r.equal_sum] } |
| 77 | + have hs (b : B) : s.fromQuotient (symbol F B b) = f b := s.π_single b |
| 78 | + refine ⟨s.fromQuotient, hs, ?_⟩ |
| 79 | + intro L hL |
| 80 | + exact Module.Relations.Quotient.linearMap_ext fun b => (hL b).trans (hs b).symm |
| 81 | + |
| 82 | +/-- The number of distinct symbols, denoted `d_p(B)` over the field of order `p`. -/ |
| 83 | +noncomputable def classCount : ℕ := by |
| 84 | + classical |
| 85 | + exact (univ.image (symbol F B)).card |
| 86 | + |
| 87 | +/-- The finite image count equals the cardinality of the range of the symbol map. -/ |
| 88 | +theorem classCount_eq_card_range : classCount F B = Nat.card (Set.range (symbol F B)) := by |
| 89 | + classical |
| 90 | + rw [Nat.card_eq_card_toFinset, Set.toFinset_range, classCount] |
| 91 | + |
| 92 | +theorem classCount_le_card : classCount F B ≤ B.card := by |
| 93 | + classical |
| 94 | + simpa [classCount] using card_image_le (s := univ) (f := symbol F B) |
| 95 | + |
| 96 | +@[simp] theorem classCount_empty : classCount F (∅ : Finset α) = 0 := |
| 97 | + Nat.eq_zero_of_le_zero (classCount_le_card F ∅) |
| 98 | + |
| 99 | +/-- The canonical symbols distinguish at least as many points as any sum-preserving labelling. -/ |
| 100 | +theorem card_image_le_classCount [DecidableEq V] (f : B → V) (hf : PreservesSums B f) : |
| 101 | + (univ.image f).card ≤ classCount F B := by |
| 102 | + classical |
| 103 | + obtain ⟨L, hL, _⟩ := existsUnique_lift F B f hf |
| 104 | + calc |
| 105 | + (univ.image f).card = ((univ.image (symbol F B)).image L).card := by |
| 106 | + rw [image_image] |
| 107 | + exact congrArg Finset.card (image_congr fun b _ => (hL b).symm) |
| 108 | + _ ≤ classCount F B := card_image_le |
| 109 | + |
| 110 | +/-- An injective sum-preserving labelling separates every symbol. -/ |
| 111 | +theorem classCount_eq_card_of_injective (f : B → V) (hf : PreservesSums B f) |
| 112 | + (hinj : Function.Injective f) : classCount F B = B.card := by |
| 113 | + classical |
| 114 | + apply le_antisymm (classCount_le_card F B) |
| 115 | + simpa [card_image_of_injective _ hinj] using card_image_le_classCount F B f hf |
| 116 | + |
| 117 | +end ErdosSwarm.Erdos530SymbolSpace |