| | @@ -0,0 +1,142 @@ |
| 1 | +import ErdosSwarm.Erdos530ProjectionMoments |
| 2 | +import Mathlib.GroupTheory.Coset.Card |
| 3 | + |
| 4 | +/-! |
| 5 | +# Collision moments by affine rank for Erdős problem 530 |
| 6 | + |
| 7 | +Let the target of a uniformly chosen linear map have cardinality `q`. A nonempty |
| 8 | +set of affine rank `d` has a single image point with probability `1 / q^d`. |
| 9 | +Grouping the unordered subsets by rank gives the exact correction to the |
| 10 | +full-rank term at every positive order. These are the finite identities in |
| 11 | +§2 of `experiments/erdos530/lower-middle-energy2/box-occupancy/POISSON.md`. |
| 12 | +For pairs in a plane of order `p`, this specializes to the collision probability |
| 13 | +`1 / p²` used in the [October 2026 report, Proposition 7.2](https://github.com/xinjiegit/sidon-palomar/blob/7a3e0ae77/docs/research-report.tex#L763-L794). |
| 14 | +-/ |
| 15 | + |
| 16 | +namespace ErdosSwarm.Erdos530RankMoments |
| 17 | + |
| 18 | +open Finset Module Erdos530ProjectionMoments Erdos530ConditionalProjection |
| 19 | +open scoped Classical |
| 20 | + |
| 21 | +variable (F : Type*) {V : Type*} [Field F] [AddCommGroup V] [Module F V] |
| 22 | + |
| 23 | +/-- Dimension of the span of all differences of points of `T`. -/ |
| 24 | +noncomputable def affineRank (T : Finset V) : ℕ := |
| 25 | + finrank F (vectorSpan F (T : Set V)) |
| 26 | + |
| 27 | +/-- Number of unordered `j`-element subsets of `A` of affine rank `d`. -/ |
| 28 | +noncomputable def rankCount (A : Finset V) (j d : ℕ) : ℕ := |
| 29 | + ((A.powersetCard j).filter fun T => affineRank F T = d).card |
| 30 | + |
| 31 | +theorem affineRank_lt_card {T : Finset V} (hT : T.Nonempty) : affineRank F T < T.card := by |
| 32 | + let : Nonempty T := hT.to_subtype |
| 33 | + have hr : Set.range (fun t : T => (t : V)) = (T : Set V) := Subtype.range_coe |
| 34 | + have h := finrank_vectorSpan_range_add_one_le F (fun t : T => (t : V)) |
| 35 | + rw [hr, Fintype.card_coe] at h |
| 36 | + exact h |
| 37 | + |
| 38 | +/-- Rank zero occurs precisely on the empty set and the singletons. -/ |
| 39 | +theorem affineRank_eq_zero_iff (T : Finset V) : affineRank F T = 0 ↔ T.card ≤ 1 := by |
| 40 | + let : FiniteDimensional F (vectorSpan F (T : Set V)) := |
| 41 | + finiteDimensional_vectorSpan_of_finite F T.finite_toSet |
| 42 | + rw [affineRank, Submodule.finrank_eq_zero, vectorSpan_eq_bot_iff_subsingleton, |
| 43 | + card_le_one_iff_subsingleton] |
| 44 | + |
| 45 | +/-- A subset of at least two elements cannot contribute to the rank-zero stratum. -/ |
| 46 | +theorem rankCount_zero_of_one_lt (A : Finset V) {j : ℕ} (hj : 1 < j) : |
| 47 | + rankCount F A j 0 = 0 := by |
| 48 | + apply card_eq_zero.mpr |
| 49 | + apply filter_eq_empty_iff.mpr |
| 50 | + intro T hT hzero |
| 51 | + exact hj.not_ge ((mem_powersetCard.mp hT).2 ▸ (affineRank_eq_zero_iff F T).mp hzero) |
| 52 | + |
| 53 | +/-- Sum by affine rank, with one contribution for each unordered subset. -/ |
| 54 | +theorem sum_rankCount_mul (A : Finset V) {j : ℕ} (hj : 0 < j) (f : ℕ → ℝ) : |
| 55 | + ∑ d ∈ range j, (rankCount F A j d : ℝ) * f d = |
| 56 | + ∑ T ∈ A.powersetCard j, f (affineRank F T) := by |
| 57 | + have hr (T : Finset V) (hT : T ∈ A.powersetCard j) : affineRank F T ∈ range j := by |
| 58 | + rw [mem_range, ← (mem_powersetCard.mp hT).2] |
| 59 | + apply affineRank_lt_card |
| 60 | + exact card_pos.mp ((mem_powersetCard.mp hT).2.symm ▸ hj) |
| 61 | + simpa only [rankCount, sum_const, nsmul_eq_mul] using sum_fiberwise_of_maps_to' hr f |
| 62 | + |
| 63 | +variable (W : Type*) [AddCommGroup W] [Module F W] [Fintype W] [DecidableEq W] |
| 64 | + [Fintype (V →ₗ[F] W)] |
| 65 | + |
| 66 | +/-- A collision is equivalent to vanishing on the direction space. Restriction |
| 67 | +to this space is surjective and its kernel consists exactly of the colliding maps. -/ |
| 68 | +theorem pow_mul_card_colliding_maps {T : Finset V} (hT : T.Nonempty) : |
| 69 | + Fintype.card W ^ affineRank F T * |
| 70 | + (univ.filter fun L : V →ₗ[F] W => (T.image L).card = 1).card = |
| 71 | + Fintype.card (V →ₗ[F] W) := by |
| 72 | + let S := vectorSpan F (T : Set V) |
| 73 | + let : FiniteDimensional F S := finiteDimensional_vectorSpan_of_finite F T.finite_toSet |
| 74 | + let res : (V →ₗ[F] W) →ₗ[F] (S →ₗ[F] W) := LinearMap.domRestrict' S |
| 75 | + have hsurj : Function.Surjective res := fun f => f.exists_extend |
| 76 | + have hcod : Nat.card (S →ₗ[F] W) = Fintype.card W ^ affineRank F T := by |
| 77 | + rw [Nat.card_congr ((finBasis F S).constr (M' := W) F).symm.toEquiv, |
| 78 | + Nat.card_eq_fintype_card, Fintype.card_fun, Fintype.card_fin] |
| 79 | + rfl |
| 80 | + have hker (L : V →ₗ[F] W) : L ∈ res.ker ↔ (T.image L).card = 1 := by |
| 81 | + rw [← vectorSpan_le_ker_iff_card_image_eq_one hT] |
| 82 | + exact ⟨fun h x hx => DFunLike.congr_fun (show res L = 0 from h) (⟨x, hx⟩ : S), |
| 83 | + fun h => LinearMap.ext fun x => h x.property⟩ |
| 84 | + have hcount : Nat.card res.ker = |
| 85 | + (univ.filter fun L : V →ₗ[F] W => (T.image L).card = 1).card := by |
| 86 | + rw [Nat.card_congr (Equiv.subtypeEquivRight hker), Nat.card_eq_fintype_card, |
| 87 | + Fintype.card_subtype] |
| 88 | + calc |
| 89 | + _ = Nat.card ((V →ₗ[F] W) ⧸ res.ker) * Nat.card res.ker := by |
| 90 | + rw [Nat.card_congr (res.quotKerEquivOfSurjective hsurj).toEquiv, hcod, hcount] |
| 91 | + _ = Nat.card (V →ₗ[F] W) := res.ker.toAddSubgroup.card_eq_card_quotient_mul_card_addSubgroup.symm |
| 92 | + _ = _ := Nat.card_eq_fintype_card |
| 93 | + |
| 94 | +/-- Fraction of all linear maps that take a single value on a nonempty set. -/ |
| 95 | +theorem collisionWeight_eq_one_div_pow {T : Finset V} (hT : T.Nonempty) : |
| 96 | + collisionWeight F W T = 1 / (Fintype.card W : ℝ) ^ affineRank F T := by |
| 97 | + unfold collisionWeight |
| 98 | + apply (div_eq_div_iff (Nat.cast_ne_zero.mpr Fintype.card_ne_zero) |
| 99 | + (pow_ne_zero _ (Nat.cast_ne_zero.mpr Fintype.card_ne_zero))).2 |
| 100 | + rw [one_mul, mul_comm] |
| 101 | + exact_mod_cast pow_mul_card_colliding_maps F W hT |
| 102 | + |
| 103 | +variable [DecidableEq V] |
| 104 | + |
| 105 | +/-- Normalized collision moment as a sum over all rank strata. -/ |
| 106 | +theorem meanCollisions_div_card_eq_rank_sum (A : Finset V) {j : ℕ} (hj : 0 < j) : |
| 107 | + meanCollisions F W A j / Fintype.card W = |
| 108 | + ∑ d ∈ range j, (rankCount F A j d : ℝ) * (1 / (Fintype.card W : ℝ) ^ (d + 1)) := by |
| 109 | + rw [sum_rankCount_mul F A hj, meanCollisions_eq_sum, sum_div] |
| 110 | + apply sum_congr rfl |
| 111 | + intro T hT |
| 112 | + have hne : T.Nonempty := card_pos.mp ((mem_powersetCard.mp hT).2.symm ▸ hj) |
| 113 | + rw [collisionWeight_eq_one_div_pow F W hne, div_div, pow_succ] |
| 114 | + |
| 115 | +/-- Every unordered subset receives the full-rank weight first. The sum |
| 116 | +adds the exact excess for ranks below `j − 1`. -/ |
| 117 | +theorem meanCollisions_div_card_eq_correction (A : Finset V) {j : ℕ} (hj : 0 < j) : |
| 118 | + meanCollisions F W A j / Fintype.card W = |
| 119 | + (A.card.choose j : ℝ) / (Fintype.card W : ℝ) ^ j + |
| 120 | + ∑ d ∈ range (j - 1), (rankCount F A j d : ℝ) * |
| 121 | + (1 / (Fintype.card W : ℝ) ^ (d + 1) - 1 / (Fintype.card W : ℝ) ^ j) := by |
| 122 | + obtain ⟨k, rfl⟩ := Nat.exists_eq_succ_of_ne_zero hj.ne' |
| 123 | + let q : ℝ := Fintype.card W |
| 124 | + let B (d : ℕ) : ℝ := rankCount F A (k + 1) d |
| 125 | + have hbase : ∑ d ∈ range (k + 1), B d * (1 / q ^ (k + 1)) = |
| 126 | + (A.card.choose (k + 1) : ℝ) / q ^ (k + 1) := by |
| 127 | + calc |
| 128 | + _ = ∑ _T ∈ A.powersetCard (k + 1), 1 / q ^ (k + 1) := |
| 129 | + sum_rankCount_mul F A k.succ_pos (fun _ => 1 / q ^ (k + 1)) |
| 130 | + _ = _ := by simp [div_eq_mul_inv] |
| 131 | + rw [meanCollisions_div_card_eq_rank_sum F W A hj] |
| 132 | + change ∑ d ∈ range (k + 1), B d * (1 / q ^ (d + 1)) = |
| 133 | + _ + ∑ d ∈ range k, B d * (1 / q ^ (d + 1) - 1 / q ^ (k + 1)) |
| 134 | + rw [← hbase] |
| 135 | + have hlast : ∑ d ∈ range (k + 1), B d * (1 / q ^ (d + 1) - 1 / q ^ (k + 1)) = |
| 136 | + ∑ d ∈ range k, B d * (1 / q ^ (d + 1) - 1 / q ^ (k + 1)) := by |
| 137 | + rw [sum_range_succ] |
| 138 | + simp |
| 139 | + rw [← hlast, ← sum_add_distrib] |
| 140 | + exact sum_congr rfl fun d _ => by ring |
| 141 | + |
| 142 | +end ErdosSwarm.Erdos530RankMoments |