Offline · exact source
Exact Lean source

YoungHyperplaneSampling

formalization/Cloning/YoungHyperplaneSampling.lean

Source hash: 7b2518b82948f509e8c705a47cb320c3bb7d2e8d1e31b2a7756d681808220105

Full source copied without mathematical changes from the snapshot whose input hash matches the passing audit. Select a line number for a stable source pointer.

The declarations belong to the compiled inventory covered by the project’s shared axiom audit. That audit records an aggregate union, without attributing axioms to individual declarations.

Declarations in this module
1import Cloning.YoungHyperplaneVolume
2 
3/-!
4# The manuscript's rescaled cells in the root hyperplane
5 
6This specializes the geometric transport to `(μ-Np+C)/sqrt N`, proves its
7Euclidean cell volume and density prefactor, and gives exact normalization,
8`ℓ¹` preservation, and affinity preservation on the full affine lattice.
9-/
10 
11set_option maxHeartbeats 800000
12set_option backward.isDefEq.respectTransparency false
13noncomputable section
14open scoped BigOperators Topology Classical
15open MeasureTheory
16 
17namespace Cloning.YoungHyperplane
18 
19/-- The actual center `(μ-Np)/sqrt N` represented in the sum-zero subspace.
20The full-coordinate formula is proved from the two mass constraints below. -/
21def sampleCenter (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ) (μ : Lattice d N) : rootSpace d :=
22  coordinates d (fun i ↦ ((μ.1 i.castSucc : ℝ) - (N : ℝ) * p i.castSucc) / Real.sqrt (N : ℝ))
23 
24theorem sampleCenter_apply (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ)
25    (hp : ∑ i, p i = 1) (μ : Lattice d N) (i : Fin (d + 1)) :
26    (sampleCenter d N p μ).1 i = ((μ.1 i : ℝ) - (N : ℝ) * p i) / Real.sqrt (N : ℝ) := by
27  refine Fin.lastCases ?_ (fun j ↦ ?_) i
28  · simp only [sampleCenter, coordinates_last, ← Finset.sum_div, Finset.sum_sub_distrib,
29      ← Finset.mul_sum]
30    have hμ : (∑ j : Fin d, (μ.1 j.castSucc : ℝ)) + (μ.1 (Fin.last d) : ℝ) = N := by
31      exact_mod_cast (show (∑ j : Fin d, μ.1 j.castSucc) + μ.1 (Fin.last d) = N by
32        simpa only [Fin.sum_univ_castSucc] using μ.2)
33    rw [Fin.sum_univ_castSucc] at hp
34    rw [← neg_div]
35    congr 1
36    have hpn := congrArg (fun t : ℝ ↦ (N : ℝ) * t) hp
37    nlinarith only [hμ, hpn]
38  · simp [sampleCenter]
39 
40/-- Membership in the rescaled half-open affine-lattice cell. -/
41def sampleCell (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ) (μ : Lattice d N) : Set (rootSpace d) :=
42  {x | (fun i : Fin d ↦ Real.sqrt (N : ℝ) * x.1 i.castSucc + (N : ℝ) * p i.castSucc) ∈
43    YoungRounding.cell ((latticeCoordinates d N).symm μ)}
44 
45theorem measurableSet_sampleCell (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ) (μ : Lattice d N) :
46    MeasurableSet (sampleCell d N p μ) := by
47  apply (measurable_pi_lambda _ fun i ↦ ?_) (YoungRounding.measurableSet_cell _)
48  exact measurable_const.mul
49    ((measurable_pi_apply i).comp (coordinatesContinuous d).symm.continuous.measurable) |>.add_const _
50 
51/-- The sample cells tile the actual root hyperplane. -/
52theorem sampleCells_cover (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ) :
53    (⋃ μ : Lattice d N, sampleCell d N p μ) = Set.univ := by
54  apply Set.eq_univ_of_forall
55  intro x
56  let y : Fin d → ℝ := fun i ↦ Real.sqrt (N : ℝ) * x.1 i.castSucc + (N : ℝ) * p i.castSucc
57  refine Set.mem_iUnion.mpr ⟨latticeCoordinates d N (YoungRounding.round y), ?_⟩
58  change y ∈ YoungRounding.cell ((latticeCoordinates d N).symm (latticeCoordinates d N (YoungRounding.round y)))
59  rw [Equiv.symm_apply_apply]
60  exact (YoungRounding.round_eq_iff _ _).mp rfl
61 
62theorem sampleCells_disjoint (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ) :
63    Pairwise fun μ ν : Lattice d N ↦ Disjoint (sampleCell d N p μ) (sampleCell d N p ν) := by
64  intro μ ν h
65  apply (YoungRounding.cells_disjoint (fun heq ↦ h ((latticeCoordinates d N).symm.injective heq))).preimage
66 
67/-- The exact induced Euclidean volume of each sample cell, including the
68root-hyperplane Jacobian. -/
69theorem volume_sampleCell (d : ℕ) (N : ℤ) (hN : 0 < (N : ℝ))
70    (p : Fin (d + 1) → ℝ) (μ : Lattice d N) :
71    volume (sampleCell d N p μ) = ENNReal.ofReal (Real.sqrt ((d : ℝ) + 1)) *
72      ENNReal.ofReal ((Real.sqrt (N : ℝ)) ^ d)⁻¹ := by
73  have hs : 0 < Real.sqrt (N : ℝ) := Real.sqrt_pos.2 hN
74  rw [volume_eq_sqrt_smul_coordinateMeasure, Measure.smul_apply,
75    coordinateMeasure, Measure.map_apply (coordinatesContinuous d).continuous.measurable
76      (measurableSet_sampleCell d N p μ)]
77  have heq : (coordinatesContinuous d) ⁻¹' sampleCell d N p μ =
78      (fun x : Fin d → ℝ ↦ Real.sqrt (N : ℝ) • x) ⁻¹'
79        ((fun x : Fin d → ℝ ↦ (fun i ↦ (N : ℝ) * p i.castSucc) + x) ⁻¹'
80          YoungRounding.cell ((latticeCoordinates d N).symm μ)) := by
81    ext x
82    simp only [Set.mem_preimage, sampleCell, Set.mem_setOf_eq]
83    apply Iff.of_eq
84    congr 1
85    ext i
86    change Real.sqrt (N : ℝ) * (coordinates d x).1 i.castSucc + (N : ℝ) * p i.castSucc =
87      (N : ℝ) * p i.castSucc + Real.sqrt (N : ℝ) * x i
88    rw [coordinates_head]
89    ring
90  rw [heq, Measure.addHaar_preimage_smul volume hs.ne', measure_preimage_add,
91    YoungRounding.volume_cell, mul_one]
92  simp only [Module.finrank_pi, Fintype.card_fin,
93    abs_of_nonneg (inv_nonneg.mpr (pow_nonneg hs.le d)), ENNReal.ofReal_inv_of_pos (pow_pos hs d), smul_eq_mul]
94 
95/-- The anchor used to express the manuscript's recentering as a translated
96root-space density. -/
97def sampleAnchor (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ) : rootSpace d :=
98  coordinates d (fun i ↦ -Real.sqrt (N : ℝ) * p i.castSucc)
99 
100def sampleInterpolate (d : ℕ) (N : ℤ) (p : Fin (d + 1) → ℝ)
101    (P : Lattice d N → ℝ) : rootSpace d → ℝ :=
102  euclideanInterpolate d N (Real.sqrt (N : ℝ))⁻¹ (sampleAnchor d N p) P
103 
104/-- On the cell indexed by `μ`, the interpolation has precisely the density
105prefactor `sqrt(N)^d / sqrt(d+1)`, with the last coordinate retained. -/
106theorem sampleInterpolate_eq_on_cell (d : ℕ) (N : ℤ) (hN : 0 < (N : ℝ))
107    (p : Fin (d + 1) → ℝ) (P : Lattice d N → ℝ) (μ : Lattice d N)
108    (x : rootSpace d) (hx : x ∈ sampleCell d N p μ) :
109    sampleInterpolate d N p P x =
110      ((Real.sqrt (N : ℝ)) ^ d / Real.sqrt ((d : ℝ) + 1)) * P μ := by
111  have hs : (Real.sqrt (N : ℝ)) ^ 2 = N := Real.sq_sqrt hN.le
112  unfold sampleInterpolate euclideanInterpolate interpolate YoungRounding.affineDensity
113  simp only [inv_inv, inv_pow, Fintype.card_fin]
114  have harg : Real.sqrt (N : ℝ) • ((coordinates d).symm x -
115      (coordinates d).symm (sampleAnchor d N p)) =
116      fun i : Fin d ↦ Real.sqrt (N : ℝ) * x.1 i.castSucc + (N : ℝ) * p i.castSucc := by
117    ext i
118    simp only [Pi.smul_apply, smul_eq_mul, Pi.sub_apply, coordinates_symm_apply,
119      sampleAnchor, coordinates_head]
120    have hsi := congrArg (fun t : ℝ ↦ t * p i.castSucc) hs
121    nlinarith only [hsi]
122  rw [harg, YoungRounding.interpolate_eq_on_cell _ _ hx, Equiv.apply_symm_apply]
123  ring
124 
125theorem sampleInterpolate_integral (d : ℕ) (N : ℤ) (hN : 0 < (N : ℝ))
126    (p : Fin (d + 1) → ℝ) (P : Lattice d N → ℝ) (hP : Summable P) :
127    (∫ x, sampleInterpolate d N p P x) = ∑' μ, P μ :=
128  euclideanInterpolate_integral d N _ (inv_pos.mpr (Real.sqrt_pos.2 hN)) _ P hP
129 
130theorem sampleInterpolate_l1_isometry (d : ℕ) (N : ℤ) (hN : 0 < (N : ℝ))
131    (p : Fin (d + 1) → ℝ) (P Q : Lattice d N → ℝ) (hP : Summable P) (hQ : Summable Q) :
132    (∫ x, |sampleInterpolate d N p P x - sampleInterpolate d N p Q x|) =
133      ∑' μ, |P μ - Q μ| :=
134  euclideanInterpolate_l1_isometry d N _ (inv_pos.mpr (Real.sqrt_pos.2 hN)) _ P Q hP hQ
135 
136theorem sampleInterpolate_affinity (d : ℕ) (N : ℤ) (hN : 0 < (N : ℝ))
137    (p : Fin (d + 1) → ℝ) (P Q : Lattice d N → ℝ)
138    (hP0 : ∀ μ, 0 ≤ P μ) (hQ0 : ∀ μ, 0 ≤ Q μ) (hP : Summable P) (hQ : Summable Q) :
139    (∫ x, Real.sqrt (sampleInterpolate d N p P x) * Real.sqrt (sampleInterpolate d N p Q x)) =
140      ∑' μ, Real.sqrt (P μ) * Real.sqrt (Q μ) :=
141  euclideanInterpolate_affinity d N _ (inv_pos.mpr (Real.sqrt_pos.2 hN)) _ P Q hP0 hQ0 hP hQ
142 
143/-- Transport a law on the full affine input lattice by the actual completed
144rounding kernel. -/
145def latticeTransport (d : ℕ) (n m : ℤ) (γ : ℝ) (P : PMF (Lattice d n)) : PMF (Lattice d m) :=
146  P.bind (latticeRoundingPMF d n m γ)
147 
148/-- Full affine-lattice transport commutes exactly with the coordinate PMF
149transport already used in the local-limit analysis. -/
150theorem latticeTransport_eq_coordinate_transport (d : ℕ) (n m : ℤ) (γ : ℝ)
151    (P : PMF (Fin d → ℤ)) :
152    latticeTransport d n m γ (latticePMF d n P) =
153      latticePMF d m (YoungRounding.transport γ P) := by
154  unfold latticeTransport latticePMF YoungRounding.transport
155  rw [PMF.bind_map, PMF.map_bind]
156  congr 1
157  funext z
158  simp only [Function.comp_apply, latticeRoundingPMF, latticePMF, latticeCoordinates_head]
159 
160end Cloning.YoungHyperplane